Page 1 of 1
JadeWebServiceSoapHeader username/password
Posted: Thu Sep 24, 2009 12:27 am
by Rich Cassell
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
Re: JadeWebServiceSoapHeader username/password
Posted: Thu Sep 24, 2009 8:32 pm
by alanvl
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.
Re: JadeWebServiceSoapHeader username/password
Posted: Thu Sep 24, 2009 11:32 pm
by Rich Cassell
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.
Re: JadeWebServiceSoapHeader username/password
Posted: Fri Sep 25, 2009 9:16 am
by torrie
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.
Re: JadeWebServiceSoapHeader username/password
Posted: Sat Sep 26, 2009 3:17 am
by Rich Cassell
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
Re: JadeWebServiceSoapHeader username/password
Posted: Tue Sep 29, 2009 2:31 am
by Rich Cassell
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