JadeWebServiceSoapHeader username/password

For questions and postings not covered by the other forums
Rich Cassell
Posts: 77
Joined: Mon Aug 24, 2009 11:22 pm
Location: Nottinghamshire, UK

JadeWebServiceSoapHeader username/password

Postby Rich Cassell » Thu Sep 24, 2009 12:27 am

Hi,

I am setting up a web service which will allow us to send data to a gateway. The service providers have given me the two required WSDL's which i have loaded with the Web Service Consumer, and they have created the methods etc within my Jade Environment.

Two of these methods have been put as subclasses of 'JadeWebServiceConsumer', and when they are called, they must send the data within a SOAP header to the gateway to verify we are who we say we are. To get through this security we need to provide a username and password within the SOAP header for them to check and accept, i am having a problem with achieving this.

Looking at the documentation, there are methods "userName" and "password" within the JadeWebServiceConsumer class, however, i cannot call these methods with my instance of the subclass object. How can i call these methods so that i can include the username and password into my SOAP header?

I appologise if this is an easy question, but i am struggling to see how to get the data into the SOAP header.

Thanks in advance for any help.

Rich

alanvl
Posts: 29
Joined: Fri Aug 14, 2009 9:16 pm

Re: JadeWebServiceSoapHeader username/password

Postby alanvl » Thu Sep 24, 2009 8:32 pm

Hi Rich, Just looking at the class definition it appears that userName and password are just attributes. In theory you should be able to set the values by direct assignment. Have not consumed any webservices myself that require password so have no actual experience of this but I see why it shouldn't work.

Rich Cassell
Posts: 77
Joined: Mon Aug 24, 2009 11:22 pm
Location: Nottinghamshire, UK

Re: JadeWebServiceSoapHeader username/password

Postby Rich Cassell » Thu Sep 24, 2009 11:32 pm

Hi alanvl, Thanks for your reply.

I have tried to call these attributes, however, it now appears that they are set to "protected" in the RootSchema, and there doesn't appear to be any set methods available. It may just be my version of RootSchema i guess.

Any more help will be very appreciated.

Rich.

torrie
Posts: 92
Joined: Fri Aug 14, 2009 11:24 am

Re: JadeWebServiceSoapHeader username/password

Postby torrie » Fri Sep 25, 2009 9:16 am

One way you could do this is to manipulate the soap message sent from Jade. We have published a web service and use the JadeWebServiceProvider::reply and JadeWebServiceProvider::processRequest to log the incoming and outgoing soap message. I believe that the JadeWebServiceConsumer::invoke method can be used on the JadeWebServiceConsumer class in a simply way. Just reimplement this method and you should be able to see the soap message that was will be sent (the inputmessage parameter) and insert your user name and password into the header. Then use inheritMethod to sent the message.

Also, just looking at the Jade help, can you add headers into the JadeWebServiceConsumer::soapHeaders collection before you send the message? I would assume that these are JadeWebServiceSoapHeader objects. While the property is protected you could add a method to your subclass to set these up appropiately.

Rich Cassell
Posts: 77
Joined: Mon Aug 24, 2009 11:22 pm
Location: Nottinghamshire, UK

Re: JadeWebServiceSoapHeader username/password

Postby Rich Cassell » Sat Sep 26, 2009 3:17 am

Hi Torrie,

Thanks for your reply! As you suggested i have reimplemented the invoke method in my subclass and it appears to be accepting my username and password into the inputMessage parameter. I don't know whether this has solved the problem, however, as i am now getting a null pointer exception, which may or may not be related.

It has definitely got further though!

Thanks!

Rich

Rich Cassell
Posts: 77
Joined: Mon Aug 24, 2009 11:22 pm
Location: Nottinghamshire, UK

Re: JadeWebServiceSoapHeader username/password

Postby Rich Cassell » Tue Sep 29, 2009 2:31 am

Hi,

After performing the previously recommended steps i am still encountering the main problem after all. The SOAP message which is sent to the Web Service Provider does not include the header information i am trying to enter.

I have attached a sample, sent to me by the provider, of how the SOAP message should be structured. In the SOAP:Body it has the DPSRequestToken data, which is a method within a subclass of JadeWebServiceConsumer. The vendorID and version tags are attributes of this class. You can also see in the SOAP:Header the wsse Security tags which include the username and password tags which i am also having a problem including.


So far, i can use the invoke method to send the header details but this isn't wrapped into the standard SOAP message, also i cannot add the SOAP:Body no matter what i try.


Does anybody know how i can use my subclass of JadeWebServiceConsumer and its methods to create this SOAP message?

Any help would be very appreciated.

Thanks, Rich
Attachments
DPSrequestToken valid sample.xml
(1.04 KiB) Downloaded 669 times


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 15 guests

cron