Convert Soap XML response to Object

后端 未结 2 1069
野的像风
野的像风 2020-12-11 08:04

i\'m new to working with SOAP API\'s

I have a soap response from an API



        
2条回答
  •  时光说笑
    2020-12-11 08:19

    IMO, you should consider using tools to handle SOAP messages instead of doing it on your own.

    Examples :

    • Java EE 5 Tutorial : Creating a Simple Web Service and Client with JAX-WS
    • Spring Boot : Consuming a SOAP message

    EDIT

    There's a few things to say about your comment so I'll put my answer here.

    First,

    I have nothing to do with the API, all I do is make a POST request...

    You have nothing to do with the API but you make a POST request to the API. I think this is a figure of speech, right ?...

    and there's no wsdl....

    You can almost always get the WSDL of a SOAP webservice with this little trick. Just add ?wsdl at the end of the SOAP webservice URL.

    Example :

    Here's the URL of a SOAP webservice on the web (a real one) : http://www.webservicex.com/stockquote.asmx

    You can get its WSDL like this : http://www.webservicex.com/stockquote.asmx?wsdl

    So the only option is to parse the response

    IMO, there's almost always more than one solution to a problem in software development.

提交回复
热议问题