Reputation: 573
I am supposed to send a XML request to this webservice which return a XML response and then I can use that XML response on my side. This is a USPS shipping label request through endicia.
POST /LabelService/EwsLabelService.asmx HTTP/1.1
Host: www.envmgr.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "www.envmgr.com/LabelService/GetPostageLabel"
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:xsd="http: //www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope /"><soap:Body>
<GetPostageLabel xmlns="www.envmgr.com/LabelService">
<LabelRequest Test="YES" LabelType="Default" LabelSize="4X6" ImageFormat="GIF">
<RequesterID>abcd</RequesterID>
<AccountID>123456</AccountID>
<PassPhrase>samplePassPhrase</PassPhrase>
<MailClass>Priority</MailClass>
<DateAdvance>0</DateAdvance>
<WeightOz>15</WeightOz>
<MailpieceShape>Parcel</MailpieceShape>
<Stealth>FALSE</Stealth>
<Services InsuredMail="OFF" DeliveryConfirmation=\u201dON\u201d SignatureConfirmation="ON" />
<Value>0</Value>
<Description>Sample Label</Description>
<PartnerCustomerID>12345ABCD</PartnerCustomerID>
<PartnerTransactionID>6789EFGH</PartnerTransactionID>
<ToName>Label Server Support</ToName>
<ToCompany>Endicia</ToCompany>
<ToAddress1>385 Sherman Ave.</ToAddress1>
<ToCity>Palo Alto</ToCity>
<ToState>CA</ToState>
<ToPostalCode>94306</ToPostalCode>
<ToZIP4>1864</ToZIP4>
<ToDeliveryPoint>00</ToDeliveryPoint>
<ToPhone>8005763279</ToPhone>
<FromName>Benjamin Franklin</FromName>
<ReturnAddress1>475 Enfant Plaza SW</ReturnAddress1>
<FromCity>Washington</FromCity>
<FromState>DC</FromState>
<FromPostalCode>20260</FromPostalCode>
<FromZIP4>0004</FromZIP4>
<FromPhone>2025551212</FromPhone>
<ResponseOptions PostagePrice="TRUE"/>
</LabelRequest>
</GetPostageLabel>
</soap:Body>
</soap:Envelope>
How to send this request and receive response?
Upvotes: 1
Views: 9286
Reputation: 41
You can use the URLConnection class to send http request if you want build the soap content yourself,Or you can use the CXF framework,That will help you convert the webservice to java interface.
Upvotes: 2