java - Parsing SOAP request sent from SOAPUI - using Axis2 Servlet -
here's soap request submitting using soapui
<?xml version="1.0" encoding="utf-8"?> <soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:my namespace="my package"> <soapenv:header> <username>q</username> <password>q</password> </soapenv:header> <soapenv:body> <op:op> <op:int>2134</op:int> </op:op> </soapenv:body> </soapenv:envelope>
now have created maven project in eclipse , have generated wsdl file, aar file (for deploying using tomcat 7) , jar file java code (java2wsdl). when request submitted, code must authorize user credentials provided under header element. however, not able parse soap request. when tried parsing with,
soapfactory fac = omabstractfactory.getsoap11factory(); soapenvelope envelope = fac.getdefaultenvelope(); soapheader header = envelope.getheader(); soapbody body = envelope.getbody(); iterator = header.getchildelements(); iterator bodyit = body.getchildelements(); while (it.hasnext()) { omelement e = (omelement) it.next(); system.out.println(e.gettext().tostring()); } while (bodyit.hasnext()) { omelement e = (omelement) bodyit.next(); system.out.println(e.gettext().tostring()); }
whereby soapfactory , other objects imported axiom, none of print statements executed. question how parse request have ability read header , body?
i apologize if vague; still new java web services.
from javadoc of soapfactory#getdefaultenvelope()
method:
create default soap envelope empty header , empty body.
so java code behaves expected.
Comments
Post a Comment