2

I want to implement a WSDL service. To generate its codes, I use from different tools. When I use SoapUI, the generated file's method is as below:

*******************************************************
<soapenv:Envelope
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:tem="http://tempuri.org/">
    <soapenv:Header>
        <tem:AuthenticationHeader>
            <tem:TicketID>?</tem:TicketID>
        </tem:AuthenticationHeader>
    </soapenv:Header>
    <soapenv:Body>
        <tem:GetInfo>
            <tem:sNo>?</tem:sNo>
            <tem:source>?</tem:source>
        </tem:GetInfo>
    </soapenv:Body>
</soapenv:Envelope>

and when I use https://app.boomerangapi.com/ on Chrome, this method will be:

<x:Envelope
    xmlns:x="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:tem="http://tempuri.org/">
    <x:Header>
        <tem:AuthenticationHeader>
            <tem:TicketID>?</tem:TicketID>
        </tem:AuthenticationHeader>
    </x:Header>
    <x:Body>
        <tem:GetInfo>
            <tem:sNo>?</tem:sNo>
            <tem:source>?</tem:source>
        </tem:GetInfo>
    </x:Body>
</x:Envelope>

Why the generated methods are different in namespaces?!

What can be the problem in the source of this service?!

1 Answers1

2

Those two SOAP bodies are exactly the same.

A namespace prefix in an element tag is just a symbolic shorthand for a namespace URI.

An XML document can define a namespace prefix using an attribute that starts with xmlns::

xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"

That attribute means “all names in this element and its descendants starting with soapenv: are actually names associated with the URI http://schemas.xmlsoap.org/soap/envelope/.”

The following namespace definition is exactly the same thing; it just specifies a different prefix to use as shorthand for the same URI:

xmlns:x="http://schemas.xmlsoap.org/soap/envelope/"

So, the only difference is that the two XML documents is how they refer to the “http://schemas.xmlsoap.org/soap/envelope/” URI:

  • The first document specifies that elements starting with soapenv: are associated with that URI.
  • The second document specifies that elements starting with x: are associated with that URI.

The notation is different, but the meaning is the same. They literally have identical content.

VGR
  • 40,506
  • 4
  • 48
  • 63
  • Thanks. The problem is that why different code generators, generate these two different xml from the same source? – Ali Hosseinzadeh Apr 11 '21 at 09:50
  • I have to add that the server just accept one of them!!! i know they are same but why the server just accept one of them? what problem has been done in source? – Ali Hosseinzadeh Apr 11 '21 at 09:51
  • 1
    If a server only accepts one of them, that server is broken; it is not XML compliant, and it is not SOAP compliant. What error message is the server returning? – VGR Apr 11 '21 at 21:54
  • org.apache.axis2.transport.http.impl.httpclient3.HTTPSenderImpl.sendViaPost:Unable to sendViaPost to url .... – Ali Hosseinzadeh Apr 12 '21 at 05:59
  • org.apache.axis2.AxisFault: Transport error: 404 Error: Not Found ...... – Ali Hosseinzadeh Apr 12 '21 at 06:00
  • That seems to be the result of the server being unable to contact some other service that it uses. Are you sure it always happens with one of your SOAP bodies and never happens with the other SOAP body? – VGR Apr 12 '21 at 11:35