I have web service client and when i send request, the soap message looks like
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<Open xmlns="ttt:some:namespace">
<PartnerName>SomeParther</PartnerName>
<NumberToS>1</NumberToS>
</Open>
</S:Body>
</S:Envelope>
and this incorrect message. The correct message looks like
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:urn="ttt:some:namespace">
<soapenv:Header />
<soapenv:Body>
<ttt:Open>
<ttt:PartnerName>SomeParther</ttt:PartnerName>
<ttt:NumberToS>1</ttt:NumberToS>
</ttt:Open>
</soapenv:Body>
</soapenv:Envelope>
how i do soap request
So_Service soService = new So_Service();
SoPort soPort = soService.getSoaphaSOAP();
/* test */
System.out.println("getServiceName from So_Service" + soService.getServiceName());
soPort.open("SomeParther", 1);
output getServiceName from So_Service ttt:some:namespace
What I'm doing wrong? What should i do for correct generate the message? Please Help
Try the below:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:urn="ttt:some:namespace">
<soapenv:Header />
<soapenv:Body>
<urn:Open>
<urn:PartnerName>SomeParther</urn:PartnerName>
<urn:NumberToS>1</urn:NumberToS>
</urn:Open>
</soapenv:Body>
</soapenv:Envelope>
Related
I am using SOAPHandler and I need to modify my SOAPMessage in SOAPNHandler:
The message i get:
<soapenv:Envelope xmlns:soapenv="...">
<soapenv:Header/>
<soapenv:Body>
<CC>
<Dat>210520</Dat>
<Tim>1156</Tim>
<MesI>20210000000830</MesI>
<MesT>CC616A</MesT>
<HEA>
<Dec>202105201156</Dec>
</HEA>
</CC>
</soapenv:Body>
</soapenv:Envelope>
I need to add a parent element AA to the body, and get this result:
<soapenv:Envelope xmlns:soapenv="...">
<soapenv:Header/>
<soapenv:Body>
<AA>
<CC>
<Dat>210520</Dat>
<Tim>1156</Tim>
<MesI>20210000000830</MesI>
<MesT>CC616A</MesT>
<HEA>
<Dec>202105201156</Dec>
</HEA>
</CC>
</AA>
</soapenv:Body>
</soapenv:Envelope>
And i can´t figure it out. I hope someone can help me.
Thank you.
I imported wsdl-file for service into Netbeans java project and one of operations not working correctly - returns null int array. But in SOAPUI everything is ok
Netbeans SOAP request is
<?xml version="1.0" ?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:getDefectsQueueRequest xmlns:ns2="eds:DefectsService"><OrgID>600</OrgID></ns2:getDefectsQueueRequest></S:Body></S:Envelope>
Netbeans responce is
<?xml version="1.0" encoding="utf-8"?><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><getDefectsQueueResponse xmlns=""><RegNums><RegNum>174272</RegNum><RegNum>174273</RegNum><RegNum>174274</RegNum></RegNums></getDefectsQueueResponse></soapenv:Body></soapenv:Envelope>
SOAPUI request is
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:eds="eds:DefectsService">
<soapenv:Header/>
<soapenv:Body>
<eds:getDefectsQueueRequest>
<OrgID>600</OrgID>
</eds:getDefectsQueueRequest>
</soapenv:Body>
</soapenv:Envelope>
SOAPUI responce is
<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>
<getDefectsQueueResponse>
<RegNums>
<RegNum>174272</RegNum>
<RegNum>174273</RegNum>
<RegNum>174274</RegNum>
</RegNums>
</getDefectsQueueResponse>
</soapenv:Body>
</soapenv:Envelope>
There is correct data in response, but dqr.getRegNums().getItem() returns null
I have the following XML as my JAX-WS web service response:
<soapenv:Envelope>
<soapenv:Header/>
<soapenv:Body>
<QueryRBTReqMsgResponse>
<QueryRBTRspMsg>
<resultHeader>
<resultCode>0</resultCode>
<resultDesc>Successful</resultDesc>
</resultHeader>
<!--Optional:-->
<QueryRBTResponse>
<part>1</part>
</QueryRBTResponse>
</QueryRBTRspMsg>
</QueryRBTReqMsgResponse>
</soapenv:Body>
</soapenv:Envelope>
But this is what I want:
<soapenv:Envelope>
<soapenv:Header/>
<soapenv:Body>
<QueryRBTRspMsg>
<resultHeader>
<resultCode>0</resultCode>
<resultDesc>Successful</resultDesc>
</resultHeader>
<!--Optional:-->
<QueryRBTResponse>
<part>1</part>
</QueryRBTResponse>
</QueryRBTRspMsg>
</soapenv:Body>
</soapenv:Envelope>
How can I remove the <QueryRBTReqMsgResponse> tag from my response? I tried too many changes but none of them did the job!!!
Finally I found the solution. We have to use following annotation:
#SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
I'm receiving a SOAP request like this, but my service can´t load the values
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns="http://schemas.xmlsoap.org/soap/envelope/"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<soapenv:Header
xmlns="http://schemas.xmlsoap.org/soap/envelope/"/>
<soapenv:Body
xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Operation xmlns="http://www.schema.com/SoS"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
...
But if I remove some of the requests tags, leaving only this
everything works ok:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<soapenv:Header
xmlns="http://schemas.xmlsoap.org/soap/envelope/"/>
<soapenv:Body>
<doOperation
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
...
For an easier reading, I removed xmlns="http://www.schema.com/SoS" from Operation, xmlns="http://schemas.xmlsoap.org/soap/envelope/" from soapenv:Envelope and xmlns="http://schemas.xmlsoap.org/soap/envelope/" from soapenv:Body.
I have a webservice where request payload is as follows
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:poc="http://www.poc.mbo.demo.com">
<soapenv:Header/>
<soapenv:Body>
<poc:doTransaction>
<!--Optional:-->
<dealerid>1</dealerid>
<!--Optional:-->
<partid>1</partid>
<!--Optional:-->
<quantity>2</quantity>
<!--Optional:-->
<orderdate>12-DEC-2012</orderdate>
</poc:doTransaction>
</soapenv:Body>
</soapenv:Envelope>
But if i try like this its giving no response. what could be the issue
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:poc="http://www.poc.mbo.demo.com">
<soapenv:Header/>
<soapenv:Body>
<poc:doTransaction>
<!--Optional:-->
<poc:dealerid>1</poc:dealerid>
<!--Optional:-->
<poc:partid>1</poc:partid>
<!--Optional:-->
<quantity>2</quantity>
<!--Optional:-->
<poc:orderdate>12-DEC-2012</poc:orderdate>
</poc:doTransaction>
</soapenv:Body>
</soapenv:Envelope>
The doTransaction elements in the first sample are not in the http://www.poc.mbo.demo.com namespace.
Your request either fails validation (assuming validation is enabled) or the server ignores the invalid elements and treats the request as being equivalent to:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:poc="http://www.poc.mbo.demo.com">
<soapenv:Header/>
<soapenv:Body>
<poc:doTransaction />
</soapenv:Body>
</soapenv:Envelope>
As per the WSDL of ur service the element would have assosiated with a namespace (a XSD), but the others may be part of another namespace (XSD),
To understand that clearly just check the WSDL the type section and the operation , check which type(Element) is assciated with which XSD.. u can easily understand y it is failing..
Think namespace as imported class and type as it's one of the state(:) Just for easy understanding)