|
|
|
|
|
|
|
 | |
 | "Dan Zrobok" <d | | NewsGroup User |
| Re: Invoking existing web service from WID | 9/24/2007 5:23:46 PM |
Reply
| 0 |   |
| Yeah, You need to use "WS-Security".. there's a ton of papers out there on the interwebz..
Basically, create a regular plain old import to your webservice.. Then in the Business Integration VIEW right click your module and open the 'Deployment Editor' inside you'll have a ton of properties you can set that relate to security for your import. In your case, you are looking to add a "Token Generator" of type "UsernamePassword" and then (on the second tab of the import binding) you create a Token Consumer for your Token Generator (I may have them backwords, doing this from memory).. Inside this second editor, Choose the generator you created. Then select the 'Use Value Type' box and select Username Token.. The two combo boxes will get filled in with some namespace gorp.. Then in the CallbackHandler, set it to "NonPromptingCallbackHandler" you can then fill in the username and password fields with whatever. Save Deploy...
Basically what you've done in those steps is configure the deployment description in the EJB project. When a request comes for that import, the Ws-Security header will get slapped in the message with your pre-configured username/password.
If you need to set the U/P in a different way, then you need to create your own callbackhandler.. A callbackhandler is your hook for setting the username/password for the service call..
That takes care of you username/password call... For the second call when you want to use the binaryToken, I'm afraid you are on your own. I've never done it before.. But I know theres Websphere WS-Security redbook on there that likely explains it..
Anyway, lemmie know.. WS-Security can be a PITA to get going for the first time..
-- Dan Zrobok Technical Architect Perficient - www.perficient.com "Experts in delivering business-driven technology solutions."
<dwforums@us.ibm.com> wrote in message news:2000191272.1190620934711.JavaMail.wassrvr@ltsgwas009.sby.ibm.com... > Thank you Dan for the reply; I managed to get this to work successfully > using the method you outlined and a simple web service. However the web > service that I am trying to invoke is not so straightforward to use! It's > a bit awkward. > > Within our core product we have two web services, FLAuthService and > FLService which provide an API to some of the most popular features of our > product. Please find attached the WSDLs of both web services in the > WSDL.zip file. When a client application requires to perform an operation, > for example searchForParty, it must first invoke the FLAuthService to > authenticate the user by passing in a username and password. This will > return a security token which must then be used in the searchForParty > request in the FLService web service. > > I am having difficulties making a simple call to the FLAuthService web > service from WID. I have created a simple Business Integration Module > within WID and within this I want to perform a call to the FLAuthService > by passing a username and password and receiving the appropriate response > and log this to the console. The problem with this is that the WSDL for > the FLAuthService is not very good in that it does not clearly specify how > to structure a request to the web service i.e. it does not mention the > security element that must be placed in the header of the SOAP message. > For example, if I import the FLAuthService WSDL into a web service tool > such XML Spy I get the choice of three operations: > [code]authenticate( ) > authenticateByProxy( FLUser User ) > verify( )[/code] > The operation I am most interested in is the authenticate( ) operation. > When I select this XML spy will generate a sample request based on the > WSDL?s schema. Because the schema does not specify the security element I > get the following sample request: > [code]<SOAP-ENV:Envelope > xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" > xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns:xsd="http://www.w3.org/2001/XMLSchema"> > <SOAP-ENV:Body/> > </SOAP-ENV:Envelope>[/code] > This request will completely fail because a security element is required > within the header of the SOAP request. This needs to be manually inserted > into the SOAP envelope as follows: > [code] > <SOAP-ENV:Envelope > xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" > xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> > <SOAP-ENV:Header> > <wsse:Security> > <wsse:UsernameToken> > <wsse:Username>ryan</wsse:Username> > <wsse:Password>1234</wsse:Password> > </wsse:UsernameToken> > </wsse:Security> > </SOAP-ENV:Header> > <SOAP-ENV:Body/> > </SOAP-ENV:Envelope>[/code] > Also note the addition of the WSSE namespace within the request. When this > request is submitted to the web service the following response is > returned: > [code] > <?xml version="1.0" encoding="UTF-8"?> > <soapenv:Envelope > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> > <soapenv:Header> > <wsse:Security soapenv:actor="" soapenv:mustUnderstand="0" > xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> > <wsse:BinarySecurityToken wsse:Id="MyId" > ValueType="wsse:X509v3" > EncodingType="wsse:Base64Binary">b7ec58f850b3c690</wsse:BinarySecurityToken> > </wsse:Security> > </soapenv:Header> > <soapenv:Body> > <authenticateResponse/> > </soapenv:Body> > </soapenv:Envelope>[/code] > The BinarySecurityToken element is then required to be inserted into the > subsequent request to the FLService. However, at the minute I really need > to concentrate on proving that I can invoke the FLAuthService from WID. > Further down the line I?ll also need to be able call the FLService web > service. > > Would you have any idea on how I could progress with this? For example, > how would I manually insert the security information XML into the header > of the request message?
|
|
| |
Free Download:
|
|
|
|
|
|
|
|
Privacy |
Contact Us
All Times Are GMT
|
|