Trying to find out why one of those two SOAP requests does not work (java.lang.IllegalArgumentException)

前端 未结 1 1970
栀梦
栀梦 2021-01-23 03:09

I have a running JAX-WS webservice which already has some working endpoints. Now I\'m having the following issue:

I\'m having two different SOAP Requests here and I don\

相关标签:
1条回答
  • 2021-01-23 03:43

    When using a prefix bound to a namespace like in

    <his:getMoldDataHistory xmlns:his="http://history.production.soap.webservices.product.company.at/">
        <machineId>92623-15853588</machineId>
        <start>0</start>
        <end>0</end>
    </his:getMoldDataHistory>
    

    then only the element getMoldDataHistory is put into the specified namespace. The reason is that the syntax xmlns:his="..." only declares the prefix. This then must used at all elements that you want to be in the specified namespace. In this code snippet, the only element is getMoldDataHistory.

    Using the xmlns="..." syntax like in

    <getMoldDataHistory xmlns="http://history.production.soap.webservices.product.company.at/">
        <machineId>92623-15853588</machineId>
        <start>0</start>
        <end>0</end>
    </getMoldDataHistory>
    

    not only declares the namespace, but also puts the associated element and all child elements into this namespace.

    Conclusion: These two XML snippets are not semantically equivalent.

    If there was such a thing as an "expanded element name" syntax, then these XML snippets would look like ...

    First one:

    <{http://history.production.soap.webservices.product.company.at/}getMoldDataHistory>
        <{}machineId>92623-15853588</{}machineId>
        <{}start>0</{}start>
        <{}end>0</{}end>
    </{http://history.production.soap.webservices.product.company.at/}getMoldDataHistory>
    

    Second one:

    <{http://history.production.soap.webservices.product.company.at/}getMoldDataHistory>
        <{http://history.production.soap.webservices.product.company.at/}machineId>92623-15853588</{http://history.production.soap.webservices.product.company.at/}machineId>
        <{http://history.production.soap.webservices.product.company.at/}start>0</{http://history.production.soap.webservices.product.company.at/}start>
        <{http://history.production.soap.webservices.product.company.at/}end>0<{/http://history.production.soap.webservices.product.company.at/}end>
    </{http://history.production.soap.webservices.product.company.at/}getMoldDataHistory>
    
    0 讨论(0)
提交回复
热议问题