Yes, you need to use the -exsh option, because that brings in the
implicit SOAP headers (i.e., those SOAP headers defined in the
wsdl:binding section of the WSDL but not the wsdl:portType) that the
Yahoo! web service provider needs.  Specifically, -exsh=true results in
the JAXB objects including those soap:header fields, which allows your
client stubs to be able to access and modify their values.

By comparing the *Service.java class created with and without that
setting, you should see the header values appear/not appear.

HTH,
Glen


2008-07-03 nmt999 wrote:
> In my client developement using cxf to talk to yahoo searchmarketing services
> (http://searchmarketing.yahoo.com/developer/docs/V4/wsdl/V4/AccountService.wsdl),
> I have two different implementations. I have them below. Case 1 works but
> not Case 2. How can I make the Case 2 work.
> 
> Does wsdl2java command when used with and without -exsh option make a
> difference for the client when making requests to a webservice. Does the two
> soap requests sent any different?
> 
> Case 1:
> =====
> wsdl2java used witn -exsh true option
> wsdl2java command used: wsdl2java -client -exsh true -p
> com.test.accountservice AccountService.wsdl
> 
> Following request was generated and  sent successfully:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>
> <soap:Header>
>       <ns2:onBehalfOfUsername
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xmlns:ns3="http://schemas.xmlsoap.org/ws/2002/07/secext";
> xmlns:ns2="http://marketing.ews.yahooapis.com/V4"; xsi:nil="true" />
>       <ns2:onBehalfOfPassword
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xmlns:ns3="http://schemas.xmlsoap.org/ws/2002/07/secext";
> xmlns:ns2="http://marketing.ews.yahooapis.com/V4"; xsi:nil="true" />
>       <ns2:masterAccountID
> xmlns:ns3="http://schemas.xmlsoap.org/ws/2002/07/secext";
> xmlns:ns2="http://marketing.ews.yahooapis.com/V4";>11111111</ns2:masterAccountID>
>       <ns2:license xmlns:ns3="http://schemas.xmlsoap.org/ws/2002/07/secext";
> xmlns:ns2="http://marketing.ews.yahooapis.com/V4";>9999999</ns2:license>
>       <ns3:Security xmlns:ns3="http://schemas.xmlsoap.org/ws/2002/07/secext";
> xmlns:ns2="http://marketing.ews.yahooapis.com/V4";>
>               <UsernameToken>
>                       <Username>username</Username>
>                       <Password>password</Password>
>               </UsernameToken>
>       </ns3:Security>
> </soap:Header>
> <soap:Body>
>     <ns2:getAccountStatus xmlns:ns2="http://marketing.ews.yahooapis.com/V4";
> xmlns:ns3="http://schemas.xmlsoap.org/ws/2002/07/secext";>
>         <ns2:accountID>222222222</ns2:accountID>
>     </ns2:getAccountStatus>
> </soap:Body>
> </soap:Envelope>
> 
> Response received successfully
> 
> Case 2:
> =====
> wsdl2java used without the exsh option
> wsdl2java command used: wsdl2java -client -p com.test.accountservice
> AccountService.wsdl
> 
> Following request was generated and sent successfully:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>
> <soap:Header>
> <wsse:Security
> xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
> soap:mustUnderstand="1">
>     <wsse:UsernameToken
> xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
> xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
> wsu:Id="UsernameToken-24164377">
>         <wsse:Username
> xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";>username</wsse:Username>
>         <wsse:Password
> xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
> Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText";>password</wsse:Password>
>     </wsse:UsernameToken></wsse:Security>
>     <masterAccountID>11111111</masterAccountID>
>     <license>999999999</license>
>     <onBehalfOfUsername />
>     <onBehalfOfPassword />
>     </soap:Header>
> <soap:Body>
>     <ns2:getAccountStatus xmlns:ns2="http://marketing.ews.yahooapis.com/V4";
> xmlns:ns3="http://schemas.xmlsoap.org/ws/2002/07/secext";>
>         <ns2:accountID>222222222</ns2:accountID>
>     </ns2:getAccountStatus>
> </soap:Body>
> </soap:Envelope>
> 
> Response received has soap fault as below:
>       <soap:Fault><faultcode>soap:Server</faultcode>
>       <faultstring>An internal error has occurred.</faultstring>
>               <detail>
>                       <yns:ApiFault 
> xmlns:yns="http://marketing.ews.yahooapis.com/V4";>
>                               <yns:code
> xmlns:yns="http://marketing.ews.yahooapis.com/V4";>E1002</yns:code>
>                               <yns:message 
> xmlns:yns="http://marketing.ews.yahooapis.com/V4";>An
> internal error has occurred.</yns:message>
>                       </yns:ApiFault>
>       </detail>
>       </soap:Fault>
> 
> 
> Regards
> nmt
> -- 
> View this message in context: 
> http://www.nabble.com/Does-wsdl2java-command-when-used-with-and-without--exsh-option-make-a-difference-for-the-client-when-making-requests-to-a-webservice-tp18260156p18260156.html
> Sent from the cxf-user mailing list archive at Nabble.com.
> 

Reply via email to