Retrieving a value from a SOAP response (Java) -
i have following soap response:
<soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <soapenv:body> <ns0:helpdesk_querylist_serviceresponse xmlns:ns0="urn:nn:hpoo:hpd_incidentinterface_ws"> <ns0:getlistvalues> <ns0:incident_number>itinc0003968505</ns0:incident_number> </ns0:getlistvalues> </ns0:helpdesk_querylist_serviceresponse> </soapenv:body> </soapenv:envelope>
how retrieve , store string ns0:incident_number?
<ns0:incident_number>itinc0003968505</ns0:incident_number>
i began creating message, attempting replicate xml structure of response above:
// create soap message messagefactory messagefactory2 = messagefactory.newinstance(); soapmessage soapmessage2 = messagefactory2.createmessage(); soappart soappart2 = soapmessage2.getsoappart(); soapenvelope envelope2 = soappart2.getenvelope(); // create soap body soapbody soapbody2 = envelope2.getbody(); //todo how represent following? <ns0:helpdesk_querylist_serviceresponse xmlns:ns0="urn:nn:hpoo:hpd_incidentinterface_ws"> <ns0:getlistvalues> <ns0:incident_number>itinc0003968505</ns0:incident_number> </ns0:getlistvalues> </ns0:helpdesk_querylist_serviceresponse> // save request soapmessage2.savechanges(); // print request message system.out.print("soap response:"); system.out.println(); soapmessage2.writeto(system.out); system.out.println(); system.out.println();
but wasn't sure other elements called or how represent them in java. do helpdesk_querylist_serviceresponse
list, getlistvalues
list , actual attribute itself? can print attribute in way or totally missing mark?
Comments
Post a Comment