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)
Related
Can someone explain it is possible to create table in wsdl file ?
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:def="http://DefaultNamespace">
<soapenv:Header/>
<soapenv:Body>
<def:addCompany>
<def:invoiceType>
<def:invoiceId>?</def:invoiceId>
<def:header1>?</def:header1>
<def:header2>?</def:header2>
<!--1 or more repetitions:-->
<def:invoiceReturn>
<def:invoiceNumber>?</def:invoiceNumber>
<def:InvoiceOrder>?</def:InvoiceOrder>
<def:totalValue>?</def:totalValue>
</def:invoiceReturn>
<!--1 or more repetitions:-->
<def:category>
<def:categoryId>?</def:categoryId>
<def:categoryName>?</def:categoryName>
</def:category>
</def:invoiceType>
</def:addCompany>
</soapenv:Body>
</soapenv:Envelope>
i have something metod like addINvoice with my header now i want to add to this method the table for exaple 3 columns mpk rk and total it is possible in wsdl ?
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 am new to API calling. I have the following things with me..
I know the wsdl url
I know the request xml stored in my local system (xml we provide when we call a API via SOAP UI)
Now how can I call the API easily via java and capture the response. In addition I need to provide credential(known to me) when accessing/calling the API
Could anyone please provide me the sample code for that.
My XML looks like that...
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" mlns:eee="http://eee.com/">
<soapenv:Header/>
<soapenv:Body>
<ehhm:createOrgUser>
<!--Optional:-->
<userData>
<!--Optional:-->
<userName>sharepointnew</userName>
<!--Optional:-->
<organizationId>609980298</organizationId>
<!--Optional:-->
<organizationAccountId>609980299</organizationAccountId>
<!--Optional:-->
<resellerId></resellerId>
<!--Optional:-->
<organizationAttribute>Education</organizationAttribute>
<!--Optional:-->
<primaryRoleName>Customer Super Admin</primaryRoleName>
<!--Zero or more repetitions:-->
<secondaryRoleName></secondaryRoleName>
<!--Optional:-->
<password>Independent12#</password>
<!--Optional:-->
<attributeList>
<!--Zero or more repetitions:-->
<attribute>
<!--Optional:-->
<key>FirstName</key>
<!--Optional:-->
<value>Morgan</value>
</attribute>
<attribute>
<!--Optional:-->
<key>LastName</key>
<!--Optional:-->
<value>Packards</value>
</attribute>
<attribute>
<!--Optional:-->
<key>ContactEmail</key>
<!--Optional:-->
<value>bmondal#ejuu.com</value>
</attribute>
</attributeList>
<!--Optional:-->
<storePwIn>true</storePwIn>
</userData>
</escm:createOrgUser>
</soapenv:Body>
</soapenv:Envelope>
So I need to create connection and call the API using this XML.
Thank in advance