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.

Reply via email to