Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Undeclared namespace prefix x:

I am a SOAP newbie and struggling with how to resolve this error message,

{:error, "500", "Undeclared namespace prefix \"x\"\n at [row,col {unknown-source}]: [1,168]"}

for the below SOAP envelope. Because of terms and conditions of the host system I am trying to access, I have replaced identifying URL and credential info with "xxx" and removed the majority of objects.

<x:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
            xmlns:read="urn://xxx/sdk/ReadObject" 
            xmlns:obj="http://xxx/object">
    <x:Header>
        <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
                       xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
            <wsse:UsernameToken>
                <wsse:Username>xxx</wsse:Username>
                <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">xxx</wsse:Password>
            </wsse:UsernameToken>
        </wsse:Security>
    </x:Header>
    <x:Body>
      <read:readEstimate>
        <read:estimate>
        <obj:id>38945</obj:id>
        </read:estimate>
      </read:readEstimate>
    </x:Body>
</x:Envelope>
like image 546
Joe Fontana Avatar asked Sep 12 '16 22:09

Joe Fontana


1 Answers

To fix the problem of an undeclared namespace prefix (x:), do any one of the following:

  1. Replace x: with soapenv: in the SOAP envelope element names.

  2. Change xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" to xmlns:x="http://schemas.xmlsoap.org/soap/envelope/".

  3. Use a default namespace by changing xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" to xmlns="http://schemas.xmlsoap.org/soap/envelope/" and removing x: in the SOAP envelope element names.

like image 85
kjhughes Avatar answered Oct 22 '22 17:10

kjhughes