axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Russ Schampers <schampers.r...@gmail.com>
Subject Re: Modify SOAP header on wsdl generated client
Date Thu, 01 Apr 2010 18:17:26 GMT
I'm not quite sure how to use the class and function you've suggested.
Perhaps a concrete code sample of what I'm trying would clear things up.
Please understand I'm new to the API and I'm struggling finding
documentation other than the signatures and very brief descriptions in the
API so I know I'm doing things incorrectly.  Below is the code I was
previously using to :

            XXXSoapBindingStub stub = new XXXSoapBindingStub();

            SOAPHeaderElement header = new SOAPHeaderElement("
http://www.guidewire.com/soap","http://www.guidewire.com/soap");
            SOAPHeaderElement element1 = new SOAPHeaderElement("
http://www.guidewire.com/soap", "gw_auth_user_prop", "su");
            SOAPHeaderElement element2 = new SOAPHeaderElement("
http://www.guidewire.com/soap", "gw_auth_password_prop", "gw");
            header.addChildElement(element1);
            header.addChildElement(element2);
            stub.setHeader(header);
            stub._setProperty(stub.ENDPOINT_ADDRESS_PROPERTY, "
http://localhost:8081/my/local/endpoint");

            stub.myFunction(myVariable);

After your suggestion I tried doing the following which utilizes the
function you were talking about but I'm intercepting the SOAP message and
now I don't even have a header doing it this way:
TestWebServiceAPISoapBindingStub stub = new
TestWebServiceAPISoapBindingStub();

            SOAPHeaderElement header = new SOAPHeaderElement("
http://www.guidewire.com/soap","http://www.guidewire.com/soap");
            SOAPHeaderElement element1 = new SOAPHeaderElement("
http://www.guidewire.com/soap", "gw_auth_user_prop", "su");
            SOAPHeaderElement element2 = new SOAPHeaderElement("
http://www.guidewire.com/soap", "gw_auth_password_prop", "gw");
            header.addChildElement(element1);
            header.addChildElement(element2);
            Call call = stub._createCall();
            call.addHeader(header);
            stub._setProperty(stub.ENDPOINT_ADDRESS_PROPERTY, "
http://localhost:8081/my/local/endpoint");

            stub.myFunction(myVariable);


Any clarification you could give would be greatly beneficial.  I'm assuming
I have to somehow explicitly execute the Call?  Perhaps I have to set the
endpoint on the Call as well?
Thanks in advance for your help so far.


On Thu, Apr 1, 2010 at 10:39 AM, <christian.poecher@bayerbbs.com> wrote:

>
> Hi Russ,
>
> you could try to play with Call#addHeader() before you #invoke() the Call.
>
> Mit freundlichen Grüßen / Best Regards
> QuinScape GmbH
> i.V. Christian Poecher
> _________________________________________
> QuinScape GmbH, Dortmund
> http://www.quinscape.de
>
> Geschäftsführer:
> Thomas Biskup     Sitz Dortmund
> Dr. Norbert Jesse    HRB 14740
> Dr. Gero Presser    Amtsgericht Dortmund
>
> Vertragspartner der Bayer Business Services GmbH
> Projekt Order Tracking Portal
> Projekt Business Service Management Portal@BHC
> Im Auftrag der
> Bayer Business Services GmbH
> Gebäude 2975, Raum 02.B2.02
> Schanzenstrasse 41
> 51063 Köln, Deutschland
>
> Tel.: +49 214 30 30988
> E-Mail: Christian.Poecher@BayerBBS.com
> Web: http://www.BayerBBS.com
>
> Geschäftsführung: Vorsitzender Daniel Hartert   |   Arbeitsdirektor Norbert
> Fieseler
> Vorsitzender des Aufsichtsrats: Klaus Kühn
> Sitz der Gesellschaft: Leverkusen   |   Amtsgericht Köln, HRB 49895
>
>
>
>  *Russ Schampers <schampers.russ@gmail.com>*
>
> 01.04.2010 15:29
>  Bitte antworten an
> java-user@axis.apache.org
>
>   An
> java-user@axis.apache.org
> Kopie
>   Thema
> Modify SOAP header on wsdl generated client
>
>
>
>
> I have a client generated from a wsdl.  The generation gives me the
> following classes:
> XXX
> XXXProxy
> XXXService
> XXXServiceLocator
> XXXSoapBindingStub
>
> For this particular web service the vendor has informed me that I need to
> include special properties in the SOAP header.  The correct SOAP header
> looks like this:
>
>       <soapenv:Header>
>    <ns1:gw_auth_user_prop soapenv:actor="*
> http://schemas.xmlsoap.org/soap/actor/next*<http://schemas.xmlsoap.org/soap/actor/next>
> "
>    soapenv:mustUnderstand="0" xmlns:ns1="*http://www.guidewire.com/soap*<http://www.guidewire.com/soap>
> ">user</ns1:gw_auth_user_prop>
>    <ns2:gw_auth_password_prop soapenv:actor="*
> http://schemas.xmlsoap.org/soap/actor/next*<http://schemas.xmlsoap.org/soap/actor/next>
> "
>    soapenv:mustUnderstand="0" xmlns:ns2="*http://www.guidewire.com/soap*<http://www.guidewire.com/soap>
> ">password</ns2:gw_auth_password_prop>
>       </soapenv:Header>
>
>
> I have tried to instantiate XXXSoapBindingStub and create a custom header
> and then call XXXSoapBindingStub.setHeader(), however I am getting
> unexpected behavior and I don't think I'm doing things "the right way".
>
>
>
> What is the correct way to use a generated client, but simply modify the
> header message being sent to conform to the above format?
>

Mime
View raw message