lundi 29 juin 2015

How to handle xml missing ns in Java SOAP WS

I'm writing a Java SOAP web service that works as follows: I'm receiving messages from 2 clients. The difference between them two is in the body of a specific field where there is a ns tag. I have implemented the web service using wsimport from a WSDL.

Client 1:

<soapenv:Envelope...>
...
    <ns9:StackOverFlow xmlns:ns9="...example...">
        ...
    </ns9:StackOverFlow>
... 
</soapenv:Envelope>

Client 2:

<soapenv:Envelope...>
...
    <StackOverFlow xmlns="...example...">
        ...
    </StackOverFlow>
... 
</soapenv:Envelope>

client1 works fine, but in client2 there is a field, StackOverFlow for example, that always converts to null in my Java web service. After debugging and looking into it, I have figured out it is because the missing ns.

Is there a way to support those 2 clients without asking them to change the xml they are sending me?

Aucun commentaire:

Enregistrer un commentaire