You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Emil Dombagolla <do...@gmail.com> on 2011/04/18 16:09:04 UTC
Set Soap Headers
Hi all,
To access the Paypal web service we need to set API credentials in each soap
request header.
I created web client for the following wsdl. And I use following code to
access the web service.
https://www.sandbox.paypal.com/wsdl/PayPalSvc.wsdl
*private static final QName SERVICE_NAME = new
QName("urn:ebay:api:PayPalAPI", "PayPalAPIInterfaceService");*
* *
*
*
*URL wsdlURL = PayPalAPIInterfaceService.WSDL_LOCATION;*
* *
*PayPalAPIInterfaceService ss = **new PayPalAPIInterfaceService(wsdlURL,
SERVICE_NAME); *
* *
*PayPalAPIAAInterface port = ss.getPayPalAPIAA();*
**
*port.doDirectPayment(d);
*
My problem is , I need to set RequesterCredentials in the Soap header. But
the generated client code does not provide me a way to set this.
so if i made a request it goes without a header.Please see the below sample.
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:DoDirectPaymentReq xmlns="
urn:ebay:apis:eBLBaseComponents" xmlns:ns2="urn:ebay:api:PayPalAPI"xmlns:ns3
="urn:ebay:apis:EnhancedDataTypes">
<ns2:DoDirectPaymentRequest>
<
DoDirectPaymentRequestDetails>
<PaymentAction>
Sale</PaymentAction>
<PaymentDetails>
<
OrderTotal currencyID="USD">100</OrderTotal>
<
ShipToAddress>
<Name>test</Name>
<Street1>Colombo</Street1>
<Street2>Colombo</Street2>
<CityName>Colombo</CityName>
<StateOrProvince>Colombo</StateOrProvince>
<Country>LK</Country>
<PostalCode>1111</PostalCode>
</
ShipToAddress>
</PaymentDetails
>
<CreditCard>
<
CreditCardType>Visa</CreditCardType>
<
CreditCardNumber>1111111111111111</CreditCardNumber>
<
ExpMonth>1</ExpMonth>
<
ExpYear>2016</ExpYear>
<
CVV2>333</CVV2>
</CreditCard>
<IPAddress>
122.22.44.33</IPAddress>
</
DoDirectPaymentRequestDetails>
</ns2:DoDirectPaymentRequest>
</ns2:DoDirectPaymentReq>
</soap:Body>
</soap:Envelope>
I want to set the header as this link describes
http://www.paypalobjects.com/en_US/ebook/PP_APIReference/architecture.html
(Figure 1.2)
If anyone know what should i do or what i have missed please help me . (Full
code attached)
thank you so much
Emil.
Re: Set Soap Headers
Posted by Daniel Kulp <dk...@apache.org>.
The EASIEST way to handle this is to add "-exsh true" to the command line when
you run the wsdl2java command. This would change the method signatures to
the methods that require the RequesterCredentials to have those in the
signature. Very easy to pass in.
Otherwise, see the FAQ:
http://cxf.apache.org/faq.html#FAQ-HowcanIaddsoapheaderstotherequest/response?
Dan
On Monday 18 April 2011 10:09:04 AM Emil Dombagolla wrote:
> Hi all,
>
>
> To access the Paypal web service we need to set API credentials in each
> soap request header.
>
>
> I created web client for the following wsdl. And I use following code to
> access the web service.
>
>
> https://www.sandbox.paypal.com/wsdl/PayPalSvc.wsdl
>
>
> *private static final QName SERVICE_NAME = new
> QName("urn:ebay:api:PayPalAPI", "PayPalAPIInterfaceService");*
> * *
>
> *
> *
>
> *URL wsdlURL = PayPalAPIInterfaceService.WSDL_LOCATION;*
>
> * *
>
> *PayPalAPIInterfaceService ss = **new PayPalAPIInterfaceService(wsdlURL,
> SERVICE_NAME); *
>
> * *
>
> *PayPalAPIAAInterface port = ss.getPayPalAPIAA();*
>
>
> **
>
> *port.doDirectPayment(d);
> *
>
>
>
> My problem is , I need to set RequesterCredentials in the Soap header. But
> the generated client code does not provide me a way to set this.
>
>
> so if i made a request it goes without a header.Please see the below
> sample.
>
>
>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>
> <soap:Body>
>
> <ns2:DoDirectPaymentReq xmlns="
> urn:ebay:apis:eBLBaseComponents"
> xmlns:ns2="urn:ebay:api:PayPalAPI"xmlns:ns3
> ="urn:ebay:apis:EnhancedDataTypes">
>
> <ns2:DoDirectPaymentRequest>
>
> <
> DoDirectPaymentRequestDetails>
>
> <PaymentAction>
> Sale</PaymentAction>
>
>
> <PaymentDetails>
>
> <
> OrderTotal currencyID="USD">100</OrderTotal>
>
> <
> ShipToAddress>
>
>
> <Name>test</Name>
>
>
> <Street1>Colombo</Street1>
>
>
> <Street2>Colombo</Street2>
>
>
> <CityName>Colombo</CityName>
>
>
> <StateOrProvince>Colombo</StateOrProvince>
>
>
> <Country>LK</Country>
>
>
> <PostalCode>1111</PostalCode>
>
> </
> ShipToAddress>
>
>
> </PaymentDetails
>
>
> <CreditCard>
>
> <
> CreditCardType>Visa</CreditCardType>
>
> <
> CreditCardNumber>1111111111111111</CreditCardNumber>
>
> <
> ExpMonth>1</ExpMonth>
>
> <
> ExpYear>2016</ExpYear>
>
> <
> CVV2>333</CVV2>
>
> </CreditCard>
>
> <IPAddress>
> 122.22.44.33</IPAddress>
>
> </
> DoDirectPaymentRequestDetails>
>
> </ns2:DoDirectPaymentRequest>
>
> </ns2:DoDirectPaymentReq>
>
> </soap:Body>
>
> </soap:Envelope>
>
>
> I want to set the header as this link describes
>
>
> http://www.paypalobjects.com/en_US/ebook/PP_APIReference/architecture.html
> (Figure 1.2)
>
>
> If anyone know what should i do or what i have missed please help me .
> (Full code attached)
>
>
> thank you so much
>
> Emil.
--
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com
Re: Set Soap Headers
Posted by Glen Mazza <gm...@talend.com>.
If you're using Axis, probably best to ask on the Axis user's list.
Here's Metro and CXF info at least:
http://www.jroller.com/gmazza/entry/implicit_soap_headers
Glen
On 07/16/2012 02:24 PM, tamahmed wrote:
> Hi, I am facing the same issue. Can you share how to set headers for paypal
> ? I am using axistools maven plugin to generate sources.
>
> Thanks Much in advance,
> Tam
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Set-Soap-Headers-tp4310836p5711136.html
> Sent from the cxf-user mailing list archive at Nabble.com.
--
Glen Mazza
Talend Community Coders
coders.talend.com
blog: www.jroller.com/gmazza
Re: Set Soap Headers
Posted by tamahmed <ta...@gmail.com>.
Hi, I am facing the same issue. Can you share how to set headers for paypal
? I am using axistools maven plugin to generate sources.
Thanks Much in advance,
Tam
--
View this message in context: http://cxf.547215.n5.nabble.com/Set-Soap-Headers-tp4310836p5711136.html
Sent from the cxf-user mailing list archive at Nabble.com.