CodeVerge.Net Beta


   Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums



Zone: > NEWSGROUP > IBM Software > ibm.software.websphere.integration-developer Tags:
Item Type: Date Entered: 9/21/2007 1:22:29 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 10 Views: 2695 Favorited: 0 Favorite
Can Reply:  Yes Members Can Edit: No Online: Yes
11 Items, 1 Pages |< << Go >> >|
<dwforums@us.ib
NewsGroup User
Invoking existing web service from WID9/21/2007 1:22:29 PM
Reply

0

Are there any articles/tutorials outlining how to invoke an existing web service from WID? I have tried searching but all I can find are articles that create a sample web service from within WID and then proceeds to call it.

I can invoke the web service using tools like XML Spy and SoapUI by passing in paramters. I just need to know how to do this in WID. I have the WSDL (which contains an XSD) for the web service.

Any help would be greatly appreciated.
"Dan Zrobok" <d
NewsGroup User
Re: Invoking existing web service from WID9/24/2007 1:34:54 AM
Reply

0

Create a new module, put the WSDL file into themodule. Open assembly
diagram. Drag wsdl onto diagram. Create New Import with Web Service binding.
Click your binding. Save assembly editor. Deploy module to server. Right
click assembly diagram and say "test module", enter values. Watch it work.
Celebrate your victory.

--
Dan Zrobok
Technical Architect
Perficient - www.perficient.com
"Experts in delivering business-driven technology solutions."


<dwforums@us.ibm.com> wrote in message
news:1399111390.1190370180182.JavaMail.wassrvr@ltsgwas009.sby.ibm.com...
> Are there any articles/tutorials outlining how to invoke an existing web
> service from WID? I have tried searching but all I can find are articles
> that create a sample web service from within WID and then proceeds to call
> it.
>
> I can invoke the web service using tools like XML Spy and SoapUI by
> passing in paramters. I just need to know how to do this in WID. I have
> the WSDL (which contains an XSD) for the web service.
>
> Any help would be greatly appreciated.


<dwforums@us.ib
NewsGroup User
Re: Invoking existing web service from WID9/24/2007 11:01:43 AM
Reply

0

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?
"Dan Zrobok" <d
NewsGroup User
Re: Invoking existing web service from WID9/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?


<dwforums@us.ib
NewsGroup User
Re: Invoking existing web service from WID9/25/2007 3:27:43 PM
Reply

0

I have tried opening the Deployment Editor but I get the message 'No web service exports exist in module TestWS. This page is therefore not available.'. Here are the steps I took:

- Create a new Business Integration Module

- Right click on the root of the module and choose 'Import...'

- Import the WSDL/Interface (this creates a new Interface entry and a new Web Service Port entry)

- Drag the Interface to the Assembly Diagram and choose 'Import with Web Service Binding' (This creates the import)

- Right click on the root of the module and select 'Open Deployment Editor' and this displays the message 'No web service exports exist in module TestWS. This page is therefore not available.'

Please note that when I create the import on the Assembly Editor I get the following 3 errors in the problems window and I'm assuming that this has something to do with it:
[code]Error: FATAL ERRORS encountered by WSDL2Java tool.

WSWS3574E: ---------- FATAL ERRORS ENCOUNTERED ----------
GENERATION OF ARTIFACTS HAS BEEN SUSPENDED.
See messages to follow for more details.

WSWS3593E: Error: Operations authenticate and verify have the same parameters elements in their input request message. Please change the wsdl.[/code]
Should I perhaps use a Mediation Module for this instead of a normal Module? It's just from looking here (http://www.ctomkins.co.uk/2006/07/12/module-or-mediation-module/) it states that a Mediation Module can access message header and that Mediation Modules are more focussed on the technology layer and describe how we connect services together.
"Dan Zrobok" <d
NewsGroup User
Re: Invoking existing web service from WID9/25/2007 4:20:09 PM
Reply

0

"MustUnderstand" is a soap thing where the sending party tells the recieving
party that they need to be able to process whatever the header is in order
for the body to be processed.. If you set MustUnderstand to zero, then
there's no guarentee that your destination service will even use the header
info provided...

Now.. I believe there is a way to turn off mustUnderstand, but it's in
the EJB deployment descriptor and I don't recommend doing it. Rather, you
should consult the documentation of the server providing the endpoint and
figure out why "It can't understand the header".. Usually its because
WS-Security isn't enabled on the endpoint you called..

IE: You send in a WS-Sec header, and the dest service doesn't use WS-sec..
"MustUnderstand=1" error.

--
Dan Zrobok
Technical Architect
Perficient - www.perficient.com
"Experts in delivering business-driven technology solutions."


<dwforums@us.ibm.com> wrote in message
news:668647310.1190734518887.JavaMail.wassrvr@ltsgwas009.sby.ibm.com...
> Ok I've almost got this working!!! I managed to get into the Deployment
> Editor; I stupidly didn't notice that there are two tabs on the Deployment
> Editor screen, one for exports and one for imports!
>
> So like I say I've almost got this working. I can now get the security
> element into the header of the soap envelope as follows:
> [code]<soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <soapenv:Header>
> <wsse:Security soapenv:mustUnderstand="1"
> xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
> <wsse:UsernameToken>
> <wsse:Username>ryan</wsse:Username>
> <wsse:Password
> Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">1234</wsse:Password>
> </wsse:UsernameToken>
> </wsse:Security>
> </soapenv:Header>
> <soapenv:Body/>
> </soapenv:Envelope>[/code]
> The problem with the above request is the soapenv:mustUnderstand="1"
> attribute. I get the following message in the response from the web
> service:
> [code]Did not understand "MustUnderstand"[/code]
> To get this to work I need set mustUnderstand to "0". I've tested this
> manually by submitting the request from SoapUI.
>
> So, how do I set the mustUnderstand attribute to "0"?


"Dan Zrobok" <d
NewsGroup User
Re: Invoking existing web service from WID9/25/2007 5:32:07 PM
Reply

0

Because the deployment descriptor is located inside a generated WID project.
WID reserves the right to over-write the DD at any time.

--
Dan Zrobok
Technical Architect
Perficient - www.perficient.com
"Experts in delivering business-driven technology solutions."


<dwforums@us.ibm.com> wrote in message
news:968523547.1190737708253.JavaMail.wassrvr@ltsgwas009.sby.ibm.com...
> But surely the destination web service [i]is[/i] using WS-Security as if i
> set mustUnderstand to "0" the response that comes back includes the
> required BinarySecurityToken?
>
> However, I know what you're saying, the destination server is not set up
> correctly. I'll see what I can do, although it looks like I may go down
> the EJB deployment descriptor path. Why do you not recommend doing it?


<dwforums@us.ib
NewsGroup User
Re: Invoking existing web service from WID9/25/2007 6:34:47 PM
Reply

0

Ok I've almost got this working!!! I managed to get into the Deployment Editor; I stupidly didn't notice that there are two tabs on the Deployment Editor screen, one for exports and one for imports!

So like I say I've almost got this working. I can now get the security element into the header of the soap envelope as follows:
[code]<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken>
<wsse:Username>ryan</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">1234</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body/>
</soapenv:Envelope>[/code]
The problem with the above request is the soapenv:mustUnderstand="1" attribute. I get the following message in the response from the web service:
[code]Did not understand "MustUnderstand"[/code]
To get this to work I need set mustUnderstand to "0". I've tested this manually by submitting the request from SoapUI.

So, how do I set the mustUnderstand attribute to "0"?
<dwforums@us.ib
NewsGroup User
Re: Invoking existing web service from WID9/25/2007 7:27:57 PM
Reply

0

But surely the destination web service [i]is[/i] using WS-Security as if i set mustUnderstand to "0" the response that comes back includes the required BinarySecurityToken?

However, I know what you're saying, the destination server is not set up correctly. I'll see what I can do, although it looks like I may go down the EJB deployment descriptor path. Why do you not recommend doing it?
<dwforums@us.ib
NewsGroup User
Re: Invoking existing web service from WID9/26/2007 12:24:25 PM
Reply

0

Surely if mustUnderstand is an attribute that can be either 0 or 1 then this should be easily set from within a client application, in this case the WID Business Module? In the [b]vast[/b] majority of situations the organization calling a web service built by another organization will not be able to get the settings of this web service changed.

Furthermore, if I take out the mustUnderstand attribute from the request when calling from SoapUI it works! So if WID is adamant that the mustUnderstand is included within the request then surely it should also give the option to change the value.
"Dan Zrobok" <d
NewsGroup User
Re: Invoking existing web service from WID9/26/2007 3:00:18 PM
Reply

0

It's not WID that's adamant that it should be included, it's the SOAP header
standards and the idea that your client should be able to parse your header
to gurantee security..

Anyway, I think mustUnderstand is a default setting.. The option may even be
in the Deployment editor you are in (where you set the other stuff) If you
google for "MustUnderstand" and Ws-Security I'm sure you'll turn up an
article on how to turn it off. I can recall doing this a year and a half
ago.. so it's possible.

--
Dan Zrobok
Technical Architect
Perficient - www.perficient.com
"Experts in delivering business-driven technology solutions."


<dwforums@us.ibm.com> wrote in message
news:1742457505.1190798696701.JavaMail.wassrvr@ltsgwas009.sby.ibm.com...
> Surely if mustUnderstand is an attribute that can be either 0 or 1 then
> this should be easily set from within a client application, in this case
> the WID Business Module? In the [b]vast[/b] majority of situations the
> organization calling a web service built by another organization will not
> be able to get the settings of this web service changed.
>
> Furthermore, if I take out the mustUnderstand attribute from the request
> when calling from SoapUI it works! So if WID is adamant that the
> mustUnderstand is included within the request then surely it should also
> give the option to change the value.


11 Items, 1 Pages |< << Go >> >|



Free Download:






   
  Privacy | Contact Us
All Times Are GMT