You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Thomas Fischer <Th...@iao.fraunhofer.de> on 2004/05/13 18:56:21 UTC

requested resource not available

Hi,
I have SOAP 2.3.1 on Tomcat 5.0.19 up and running.

SOAP examples work fine for me, so the overall setup
should be fine. But I get an error message when trying
to run the examples from "oreilly JavaWebServices" Book
(http://examples.oreilly.com/javawebserv/)

For me it looks like the Server Side class SimpleHTTPReceive
is not accessible for Apache SOAP. I placed the class under
webapps/examples/WEB-INF/classes as requested. Is there
anything else that I'll have to configure?

I know, the examples are for tomcat 3.x / 4.x but it should
be possible to get this stuff up and running in a more
recent environment.

Any hints are welcome - Cheers - Tom


Error Message follows:
=========================================================================

Sent SOAP Message with Apache HTTP SOAP Client.
Waiting for response....
<html><head><title>Apache Tomcat/5.0.19 - Error 
report</title><style><!--H1 
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} 
H2 
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} 
H3 
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} 
BODY 
{font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} 
B 
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} 
P 
{font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A 
{color : black;}A.name {color : black;}HR {color : #525D76;}--></style> 
</head><body><h1>HTTP Status 404 - 
/examples/servlet/SimpleHTTPReceive</h1><HR size="1" 
noshade><p><b>type</b> Status report</p><p><b>message</b> 
<u>/examples/servlet/SimpleHTTPReceive</u></p><p><b>description</b> 
<u>The requested resource (/examples/servlet/SimpleHTTPReceive) is not 
available.</u></p><HR size="1" noshade><h3>Apache 
Tomcat/5.0.19</h3></body></html>




_________________________________________________________________

   Dr.-Ing. Dipl.-Phys. Thomas Fischer          Fraunhofer IAO
                                                Nobelstr. 12
   phone +49 (0)711 / 970-2037  fax -2299       70569 Stuttgart
   email Thomas.Fischer@iao.fraunhofer.de       Germany
_________________________________________________________________


Re: requested resource not available

Posted by Thomas Fischer <Th...@iao.fraunhofer.de>.

I placed the SimpleHTTPReceive class in $CATALINA under 
webapps/examples/WEB-INF/classes as requested in the manual.
Is there anything else (server.xml, web.xml, ... ) that I'll
have to configure?

Cheers - Thomas


Scott Nichol schrieb:

> How (where) did you install the classes for the example?
> 
> Scott Nichol
> 
> Do not send e-mail directly to this e-mail address,
> because it is filtered to accept only mail from
> specific mail lists.
> ----- Original Message ----- 
> From: "Thomas Fischer" <Th...@iao.fraunhofer.de>
> To: <so...@ws.apache.org>
> Sent: Friday, May 14, 2004 3:56 AM
> Subject: Re: requested resource not available
> 
> 
> 
> Hi Scott,
> deployment works fine, I either use the SOAP GUI
> or (preferred) deploy via deployment descriptor:
> 
> java org.apache.soap.server.ServiceManagerClient 
> http://hal:8088/soap/servlet/rpcrouter deploy PurchaseOrderAcceptorDD.xml
> 
> 
> PurchaseOrderAcceptorDD.xml:
> =========================================================================
> <isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment"
>    id="urn:oreilly-jaws-samples" type="message">
>    <isd:provider
>         type="java"
>         scope="Application"
>         methods="PurchaseOrder PurchaseOrderWithAttachment">
>       <isd:java class="PurchaseOrderAcceptor"/>
>    </isd:provider>
> <isd:faultListener>org.apache.soap.server.DOMFaultListener</isd:faultListener>
> </isd:service>
> =========================================================================
> 
> 
> Checking the result of deployment via
> # java org.apache.soap.server.ServiceManagerClient
>        http://hal:8088/soap/servlet/rpcrouter list
> results as expected in a :
> Deployed Services:
>          urn:oreilly-jaws-samples
> 
> 
> 
> Any ideas what's wrong? - Thomas
> 
> 
> Scott Nichol schrieb:
> 
>>What steps have you followed to deploy this sample code?
>>
>>Scott Nichol
>>
>>Do not send e-mail directly to this e-mail address,
>>because it is filtered to accept only mail from
>>specific mail lists.
>>----- Original Message ----- 
>>From: "Thomas Fischer" <Th...@iao.fraunhofer.de>
>>To: <so...@ws.apache.org>
>>Sent: Thursday, May 13, 2004 12:56 PM
>>Subject: requested resource not available
>>
>>
>>
>>Hi,
>>I have SOAP 2.3.1 on Tomcat 5.0.19 up and running.
>>
>>SOAP examples work fine for me, so the overall setup
>>should be fine. But I get an error message when trying
>>to run the examples from "oreilly JavaWebServices" Book
>>(http://examples.oreilly.com/javawebserv/)
>>
>>For me it looks like the Server Side class SimpleHTTPReceive
>>is not accessible for Apache SOAP. I placed the class under
>>webapps/examples/WEB-INF/classes as requested. Is there
>>anything else that I'll have to configure?
>>
>>I know, the examples are for tomcat 3.x / 4.x but it should
>>be possible to get this stuff up and running in a more
>>recent environment.
>>
>>Any hints are welcome - Cheers - Tom
>>
>>
>>Error Message follows:
>>=========================================================================
>>
>>Sent SOAP Message with Apache HTTP SOAP Client.
>>Waiting for response....
>><html><head><title>Apache Tomcat/5.0.19 - Error 
>>report</title><style><!--H1 
>>{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} 
>>H2 
>>{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} 
>>H3 
>>{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} 
>>BODY 
>>{font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} 
>>B 
>>{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} 
>>P 
>>{font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A 
>>{color : black;}A.name {color : black;}HR {color : #525D76;}--></style> 
>></head><body><h1>HTTP Status 404 - 
>>/examples/servlet/SimpleHTTPReceive</h1><HR size="1" 
>>noshade><p><b>type</b> Status report</p><p><b>message</b> 
>><u>/examples/servlet/SimpleHTTPReceive</u></p><p><b>description</b> 
>><u>The requested resource (/examples/servlet/SimpleHTTPReceive) is not 
>>available.</u></p><HR size="1" noshade><h3>Apache 
>>Tomcat/5.0.19</h3></body></html>
>>
>>
>>
>>
>>_________________________________________________________________
>>
>>   Dr.-Ing. Dipl.-Phys. Thomas Fischer          Fraunhofer IAO
>>                                                Nobelstr. 12
>>   phone +49 (0)711 / 970-2037  fax -2299       70569 Stuttgart
>>   email Thomas.Fischer@iao.fraunhofer.de       Germany
>>_________________________________________________________________
>>
>>
> 
> 

-- 
_________________________________________________________________

   Dr.-Ing. Dipl.-Phys. Thomas Fischer          Fraunhofer IAO
                                                Nobelstr. 12
   phone +49 (0)711 / 970-2037  fax -2299       70569 Stuttgart
   email Thomas.Fischer@iao.fraunhofer.de       Germany
_________________________________________________________________


Re: SOAP method to get server/ip of incoming message source

Posted by Daniel Zhang <zh...@clinicaltools.com>.
Thanks Martin! Without discussion like this, it'll take me hours and 
days of time to find out those tricks.
Best,
Daniel

Martin Gainty wrote:

>Daniel-
>the suggestion gets the request from SOAPContext via
> HttpServletRequest hsr = req.getProperty(Constants.BAG_HTTPSERVLETREQUEST);
>
>you can then get ALL of the HTTP Variable parameters that the Request has
>access to via
>hsr.getQueryString() OR
>hsr.getHost()
>to see all the HTTP Variables you have access to take a look at
>http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/http/HttpServletRequest.html
>Regards,
>-Martin
>----- Original Message ----- 
>From: "Daniel Zhang" <zh...@clinicaltools.com>
>To: <so...@ws.apache.org>
>Sent: Wednesday, May 26, 2004 9:27 AM
>Subject: Re: SOAP method to get server/ip of incoming message source
>
>
>  
>
>>Thank you Scott! That's what I want. We are using messaging API.
>>Actually I am looking at the SOAPContext class, but I didn't find method
>>to getRemoteAddr/getRemoteHost directly and I don't the trick to use
>>getProperty(Constants.BAG_HTTPSERVLETREQUEST).
>>
>>Daniel
>>
>>Scott Nichol wrote:
>>
>>    
>>
>>>You will need to access the SOAPContext for the request.  This allows you
>>>      
>>>
>to access the HttpServletRequest, on which the getRemoteAddr or
>getRemoteHost method will give you what you need.
>  
>
>>>Does your service use the RPC or messaging API?  For the messaging API,
>>>      
>>>
>you get the SOAPContext for the request passed into your service method.
>For the RPC API, you need to use a trick: add SOAPContext as the first
>parameter to your method.  For example, if your method is
>  
>
>>>   String foo(String bar, int baz)
>>>
>>>change it to
>>>
>>>   String foo(SOAPContext req, String bar, int baz)
>>>
>>>Now that you have the SOAPContext, use the getProperty method with the
>>>      
>>>
>parameter  Constants.BAG_HTTPSERVLETREQUEST, i.e.
>  
>
>>>   HttpServletRequest hsr =
>>>      
>>>
>req.getProperty(Constants.BAG_HTTPSERVLETREQUEST);
>  
>
>>>This is documented in the User Guide
>>>      
>>>
>(http://ws.apache.org/soap/docs/guide/migration.html).
>  
>
>>>Scott Nichol
>>>
>>>Do not send e-mail directly to this e-mail address,
>>>because it is filtered to accept only mail from
>>>specific mail lists.
>>>----- Original Message ----- 
>>>From: "Daniel Zhang" <zh...@clinicaltools.com>
>>>To: <so...@ws.apache.org>
>>>Sent: Tuesday, May 25, 2004 2:30 PM
>>>Subject: SOAP method to get server/ip of incoming message source
>>>
>>>
>>>
>>>
>>>      
>>>
>>>>Hi, All:
>>>>
>>>>In SOAP package, is there any method could retrieve servername/IP of
>>>>incoming source?  I need a method sitting on the server side to tell the
>>>>client servername or IP.
>>>>
>>>>Thanks,
>>>>
>>>>Daniel
>>>>
>>>>
>>>>
>>>>        
>>>>
>>    
>>


Re: SOAP method to get server/ip of incoming message source

Posted by Martin Gainty <mg...@hotmail.com>.
Daniel-
the suggestion gets the request from SOAPContext via
 HttpServletRequest hsr = req.getProperty(Constants.BAG_HTTPSERVLETREQUEST);

you can then get ALL of the HTTP Variable parameters that the Request has
access to via
hsr.getQueryString() OR
hsr.getHost()
to see all the HTTP Variables you have access to take a look at
http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/http/HttpServletRequest.html
Regards,
-Martin
----- Original Message ----- 
From: "Daniel Zhang" <zh...@clinicaltools.com>
To: <so...@ws.apache.org>
Sent: Wednesday, May 26, 2004 9:27 AM
Subject: Re: SOAP method to get server/ip of incoming message source


> Thank you Scott! That's what I want. We are using messaging API.
> Actually I am looking at the SOAPContext class, but I didn't find method
> to getRemoteAddr/getRemoteHost directly and I don't the trick to use
> getProperty(Constants.BAG_HTTPSERVLETREQUEST).
>
> Daniel
>
> Scott Nichol wrote:
>
> >You will need to access the SOAPContext for the request.  This allows you
to access the HttpServletRequest, on which the getRemoteAddr or
getRemoteHost method will give you what you need.
> >
> >Does your service use the RPC or messaging API?  For the messaging API,
you get the SOAPContext for the request passed into your service method.
For the RPC API, you need to use a trick: add SOAPContext as the first
parameter to your method.  For example, if your method is
> >
> >    String foo(String bar, int baz)
> >
> >change it to
> >
> >    String foo(SOAPContext req, String bar, int baz)
> >
> >Now that you have the SOAPContext, use the getProperty method with the
parameter  Constants.BAG_HTTPSERVLETREQUEST, i.e.
> >
> >    HttpServletRequest hsr =
req.getProperty(Constants.BAG_HTTPSERVLETREQUEST);
> >
> >This is documented in the User Guide
(http://ws.apache.org/soap/docs/guide/migration.html).
> >
> >Scott Nichol
> >
> >Do not send e-mail directly to this e-mail address,
> >because it is filtered to accept only mail from
> >specific mail lists.
> >----- Original Message ----- 
> >From: "Daniel Zhang" <zh...@clinicaltools.com>
> >To: <so...@ws.apache.org>
> >Sent: Tuesday, May 25, 2004 2:30 PM
> >Subject: SOAP method to get server/ip of incoming message source
> >
> >
> >
> >
> >>Hi, All:
> >>
> >>In SOAP package, is there any method could retrieve servername/IP of
> >>incoming source?  I need a method sitting on the server side to tell the
> >>client servername or IP.
> >>
> >>Thanks,
> >>
> >>Daniel
> >>
> >>
> >>
>
>

Re: SOAP method to get server/ip of incoming message source

Posted by Daniel Zhang <zh...@clinicaltools.com>.
Thank you Scott! That's what I want. We are using messaging API.  
Actually I am looking at the SOAPContext class, but I didn't find method 
to getRemoteAddr/getRemoteHost directly and I don't the trick to use 
getProperty(Constants.BAG_HTTPSERVLETREQUEST).

Daniel

Scott Nichol wrote:

>You will need to access the SOAPContext for the request.  This allows you to access the HttpServletRequest, on which the getRemoteAddr or getRemoteHost method will give you what you need.
>
>Does your service use the RPC or messaging API?  For the messaging API, you get the SOAPContext for the request passed into your service method.  For the RPC API, you need to use a trick: add SOAPContext as the first parameter to your method.  For example, if your method is
>
>    String foo(String bar, int baz)
>
>change it to
>
>    String foo(SOAPContext req, String bar, int baz)
>
>Now that you have the SOAPContext, use the getProperty method with the parameter  Constants.BAG_HTTPSERVLETREQUEST, i.e.
>
>    HttpServletRequest hsr = req.getProperty(Constants.BAG_HTTPSERVLETREQUEST);
>
>This is documented in the User Guide (http://ws.apache.org/soap/docs/guide/migration.html).
>
>Scott Nichol
>
>Do not send e-mail directly to this e-mail address,
>because it is filtered to accept only mail from
>specific mail lists.
>----- Original Message ----- 
>From: "Daniel Zhang" <zh...@clinicaltools.com>
>To: <so...@ws.apache.org>
>Sent: Tuesday, May 25, 2004 2:30 PM
>Subject: SOAP method to get server/ip of incoming message source
>
>
>  
>
>>Hi, All:
>>
>>In SOAP package, is there any method could retrieve servername/IP of 
>>incoming source?  I need a method sitting on the server side to tell the 
>>client servername or IP.
>>
>>Thanks,
>>
>>Daniel
>>
>>    
>>


Re: SOAP method to get server/ip of incoming message source

Posted by Scott Nichol <sn...@scottnichol.com>.
You will need to access the SOAPContext for the request.  This allows you to access the HttpServletRequest, on which the getRemoteAddr or getRemoteHost method will give you what you need.

Does your service use the RPC or messaging API?  For the messaging API, you get the SOAPContext for the request passed into your service method.  For the RPC API, you need to use a trick: add SOAPContext as the first parameter to your method.  For example, if your method is

    String foo(String bar, int baz)

change it to

    String foo(SOAPContext req, String bar, int baz)

Now that you have the SOAPContext, use the getProperty method with the parameter  Constants.BAG_HTTPSERVLETREQUEST, i.e.

    HttpServletRequest hsr = req.getProperty(Constants.BAG_HTTPSERVLETREQUEST);

This is documented in the User Guide (http://ws.apache.org/soap/docs/guide/migration.html).

Scott Nichol

Do not send e-mail directly to this e-mail address,
because it is filtered to accept only mail from
specific mail lists.
----- Original Message ----- 
From: "Daniel Zhang" <zh...@clinicaltools.com>
To: <so...@ws.apache.org>
Sent: Tuesday, May 25, 2004 2:30 PM
Subject: SOAP method to get server/ip of incoming message source


> Hi, All:
> 
> In SOAP package, is there any method could retrieve servername/IP of 
> incoming source?  I need a method sitting on the server side to tell the 
> client servername or IP.
> 
> Thanks,
> 
> Daniel
> 

Re: SOAP method to get server/ip of incoming message source

Posted by Daniel Zhang <zh...@clinicaltools.com>.
Martin:

The method you are talking about is the client side.  And we have no 
control of our partners(clients) side. We only know our clients sending 
us SOAP message and we(server side) need to tell the URLs/IPs of our 
clients.

Daniel
mail.laconiadatasystems.com wrote:

>Daniel-
>
>>>From the URL you can get your QueryString e.g.
>
>  URL url = new URL ("http://www.mySoapRouter.com/soap/servlet/rpcrouter");
>  Response resp = call.invoke (url, "");
>
>  string query=url.getQuery();
>  string host = url.getHost();
>  /*and most anything else you need can be extracted from the url*/
>  HTH,
>  Martin
>----- Original Message ----- 
>From: "Daniel Zhang" <zh...@clinicaltools.com>
>To: <so...@ws.apache.org>
>Sent: Tuesday, May 25, 2004 2:30 PM
>Subject: SOAP method to get server/ip of incoming message source
>
>
>  
>
>>Hi, All:
>>
>>In SOAP package, is there any method could retrieve servername/IP of
>>incoming source?  I need a method sitting on the server side to tell the
>>client servername or IP.
>>
>>Thanks,
>>
>>Daniel
>>
>>    
>>


SOAP method to get server/ip of incoming message source

Posted by Daniel Zhang <zh...@clinicaltools.com>.
Hi, All:

In SOAP package, is there any method could retrieve servername/IP of 
incoming source?  I need a method sitting on the server side to tell the 
client servername or IP.

Thanks,

Daniel

Re: SOAP with Attachment

Posted by Martin Gainty <mg...@hotmail.com>.
The following illustration shows a document-style message arriving at
themessagerouter URL and an RPC-style message arriving at the rpcrouter
URL.Document-styleRPC-styleApplicationserverService. Includes code toparse
contents ofSOAP messagemessagerouterSOAPmessage
bodyApplicationserverService. Expects a certainnumber and orderof message
partsrpcrouterSOAPmessage partSOAP message going to messagerouter
(document-style) or rpcrouter (RPC-style)A SOAP connector exampleFor direct
CrossWorlds-to-CrossWorlds connectivity, the SOAP connector creates
adocument-style SOAP message. This message is sent to the messagerouter URL
ofthe application server that hosts the CrossWorlds proxy class. An
exampledocument-style message sent from the SOAP connector is shown
below:Advanced Topics3
----------------------------------------------------------------------------
----
      Page 8
<?xml version='1.0' encoding='UTF-8'?><SOAP-ENV:Envelope xmlns:SOAP-ENV=
"http://schemas.xmlsoap.org/soap/envelope/"xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance" SOAP-ENV:encodingStyle=
"http://schemas.xmlsoap.org/soap/encoding/"xmlns:xsd=
"http://www.w3.org/2001/XMLSchema"><SOAP-ENV:Header><hns0:affiliate
xmlns:hns0="http://www.ibm.com/wbc"
><DestIDIdentifier>stevesh</DestIDIdentifier><DestIDType>PartnerName</DestID
Type></hns0:affiliate></SOAP-ENV:Header><SOAP-ENV:Body><ns1:m_BCT_DocStyleTe
st xmlns:ns1="urn:ibmwsgw#BCT_DocStyleTest_Retrieve"><child>
<field1>true</field1><field2>1</field2><field3>1.1</field3><field4>1E2</fiel
d4><field5>string1</field5><field6>2002-05-14T19:26:00Z</field6><field7>long
text
1</field7></child></ns1:m_BCT_DocStyleTest></SOAP-ENV:Body></SOAP-ENV:Envelo
pe>Notice the bold part of the message. This is where the CrossWorlds data
handlerplaces the data fields from the generic business object in the SOAP
message. If youlook at the data for the fields, you have some sense of their
data type, but there isnothing to tell the service that handles the message
anything about the data types.This message will be read by the messagerouter
servlet, and the contents of theSOAP-Env:Body will be passed to the service
whose ID is named in the Bodynamespace of the message
(urn:ibmwsgw#BCT_DocStyleTest_Retrieve). Themethod specified by the Body
name of the message Body will be called for thisservice ID (that is, method
name m_BCT_DocStyleTest will be called).For document-style services, the
service methods all have the same parameter list.One of the parameters is
the SOAP Envelope. The messagerouter creates aninstance of
org.apache.soap.Envelope using the message contents. It passes theEnvelope
to the service method, which must include code to parse it appropriatelyand
process the contents.RPC message semanticsRecall that the RPC model mimics a
method call using a SOAP message. Themessage encapsulates the parameters for
the call in its Body. The order and type ofthe parameters must match the
parameter list of the service Java method to invoke.RPC messages are sent to
the rpcrouter URL of the SOAP application server ratherthan the
messagerouter URL. The rpcrouter takes the contents of the SOAPEnvelope and
creates an instance of a Java type for each message part. These Javaobjects
are used as parameters to invoke a method on a Java class. Remember thatthe
method name is the SOAP message Body part name, and the class name isfound
by the ID of the service, which is the SOAP message Body namespace.For the
rpcrouter to know the proper types of the parameters, the RPC-stylemessage
has to include type information along with each part in the message.4Web
Services Advanced Topics
----------------------------------------------------------------------------
----
      Page 9
Using the SOAP Connector to send RPC-style messagesThe CrossWorlds SOAP
connector can be configured via the meta-objects it uses tosend messages
that use RPC-style semantics. This allows you to call Web servicesthat
expect RPC-style SOAP messages.To configure the use of RPC-style semantics,
you set the value of the TypeInfo fieldin the BOtoSOAP client meta-object
for your SOAP request application-specificbusiness object to the value true.
The following screen shows TypeInfo set to true.Attributes tab with TypeInfo
field set to trueThe resulting SOAP message issued by the SOAP connector now
has RPCsemantics, as you can see by the type information in each field in
the followingexample message:<?xml version='1.0' encoding='UTF-8'
?><SOAP-ENV:Envelope xmlns:SOAP-ENV=
"http://schemas.xmlsoap.org/soap/envelope/"xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance" SOAP-ENV:encodingStyle=
"http://schemas.xmlsoap.org/soap/encoding/"xmlns:xsd=
"http://www.w3.org/2001/XMLSchema"><SOAP-ENV:Header><hns0:affiliate
xmlns:hns0="http://www.ibm.com/wbc"
><DestIDIdentifier>stevesh</DestIDIdentifier><DestIDType>PartnerName</DestID
Type></hns0:affiliate></SOAP-ENV:Header><SOAP-ENV:Body><ns1:m_BCT_RPCStyleTe
st xmlns:ns1="urn:ibmwsgw#BCT_RPCStyleTest_Retrieve"><child xsi:type=
"ns1:BCT_RPCStyleTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
><field1 xsi:type="xsd:boolean">true</field1><field2 xsi:type="xsd:int"
>1</field2><field3 xsi:type="xsd:float">1.1</field3><field4 xsi:type=
"xsd:double">1E2</field4><field5 xsi:type="xsd:string"
>string1</field5><field6 xsi:type="xsd:dateTime"
>2002-05-14T19:26:00Z</field6><field7 xsi:type="xsd:string">long text
1</field7></child></ns1:m_BCT_RPCStyleTest></SOAP-ENV:Body></SOAP-ENV:Envelo
pe>The bold part of the message text has type information that is used by
therpcrouter when it builds the parameter list.Advanced Topics5
----------------------------------------------------------------------------
----
      Page 10
Web Services Gateway messagesSOAP messages that are processed by the Web
Services Gateway must use RPCsemantics. The channels used by the Business
Connection offering are based on theSOAP rpcrouter servlet, so for the Web
Services Gateway to correctly processmessages sent to a SOAP channel, the
messages must include type information.The CWGenUtility provided by the
Business Connection offering to produce theCrossWorlds artifacts for a Web
service produces meta-object definitions with theTypeInfo field set to true
where it is appropriate. This means that the SOAPconnector will produce
messages that can be processed by the Web ServicesGateway channels.SOAP
connector limitationsFor an RPC-style Web service to be called by the SOAP
Connector, theselimitations must be accommodated:v Only a single namespace
can be used by the body of the message and all of itsparts.v Only some data
types may be present in the Web-service interface. These includestring,
integer, float, double, and the other simple types supported by
theCrossWorlds Business Object Designer. Commonly used Java classes such
asVector and Hashtable, however, may not be used in the interface to a
Webservice if it is to be called from the SOAP Connector.v Complex types
containing zero or more attributes of a simple type (asmentioned above) and
zero or more attributes of a complex type are allowed.v Arrays must be
composed of complex types, not simple types.These limitations are mainly
derived from the fact that business objects are used toform the message that
is sent by the SOAP connector. Any data in the messagemust have a
CrossWorlds data type. Because CrossWorlds arrays (N-cardinalitychildren)
must be composed of business objects and not of simple types, anyarrays in
the Web-service interface must be arrays of complex types.The RPC Sample
ScenarioAn example of a Java Web service developed using WebSphere
ApplicationDeveloper that is called from a collaboration via the SOAP
connector is providedwith the Business Connection offering. The theme of
this sample is an expandedversion of the common Stock Quote service.The
sample allows you to enter a list of one or more stock symbols as an array
ofbusiness objects. This list is sent as a SOAP message via the SOAP
connector to therpcrouter URL of a SOAP-enabled application server deployed
in WebSphere. TheWeb service that processes the request, which was created
with WebSphereApplication Developer, is deployed in the sample application
server. The rpcrouterservlet forms a method call from the message and calls
the service class. If theserver has connectivity to http://www.xmltoday.com,
a quote for each symbol inthe request list will be obtained. If there is no
connectivity, a list is returned witherror values (-1.0) in the quote
response fields. The response list is sent backsynchronously to the
caller.6Web Services Advanced Topics
----------------------------------------------------------------------------
----
      Page 11
Installing the RPC service in WebSphereThe RPC Stockquote service is
provided in a SOAP-enabled EAR file.To install the RPC service:1. Bring up
your WebSphere Admin Console.2. Install bctwssamplesrpc.ear into an
application server of your choice (thedefault server, for example). Do not
install the EAR file into the Web ServicesGateway App Server.3. Regenerate
the Web server plug-in, stop the application server (if it is running),and
then restart (or start) the application server where you installed the
EARfile.Reviewing the Java code for the Web serviceThe source code for the
classes used by the sample service is included at the endof this document.
Look at the following classes that are used by the service:v
com.ibm.bct.ws.samples.rpc.QuoteRequest:Encapsulates a String field named
symbol to carry a request for a single quote.v
com.ibm.bct.ws.samples.rpc.QuoteResponse:Encapsulates two String fields
named symbol and quote to carry a singlequotation back to the caller.v
com.ibm.bct.ws.samples.rpc.RequestList:Encapsulates a String field named
date and an array of QuoteRequest objects.This is the request type for the
StockQuote getCompanyQuotes(RequestList)method.v
com.ibm.bct.ws.samples.rpc.ResponseList:Encapsulates a String field named
date and an array of QuoteResponse objects.This the return type for the
getCompanyQuotes(RequestList) method.v
com.ibm.bct.ws.samples.rpc.Stockquote:This is the class which provides the
getCompanyQuotes(RequestList) method.This is the Web service
implementation.Installing the sample CrossWorlds codeTo install the code:1.
Refer to the CrossWorlds Samples section of the Web Services Overview
andSamples and import the Business Connection sample CrossWorlds data if
youhave not already done so.2. Before running the sample, you will need to
compile the collaboration templatenamed StockQuoteServiceOutbound.3. After
you have done this, stop and restart the ICS.4. Check the system view to be
sure that the collaboration object
namedBCT_SampleConnector1_to_BCT_SampleSOAPConnector_StockQuoteServiceOutbou
nd has started.5. Also make sure the BCT_SampleSOAPConnector has started.
You can checkthat the connector controller is started by viewing the System
View window.You also need to start the connector agent for this connector.
Refer to the WebServices Overview and Samples document to review how this is
done.6. Look at the collaboration template and the collaboration object.
They are similarto the previousBCT_TestAllTypesOutbound sample.Advanced
Topics7
----------------------------------------------------------------------------
----
      Page 12
Because this sample calls out from CrossWorlds to a Java RPC Web service,
there isno inbound collaboration.Reviewing the business objectsTo review the
business object:1. Open the StockquoteService folder in the CrossWorlds
BCT_WS_Samplesproject.2. Look at the business object definitions for this
service.In addition to the SOAP meta-objects for sending a message via the
SOAPconnector, there are also some business objects that have names
resembling thefour interface classes used by the StockQuote RPC Web service.
The businessobjects are shown in the screen below.If you open these business
objects, you can see that they have attributes thatcorrespond to the fields
of the Java classes. In particular, notice that the arraysof the Java
classes have corresponding arrays (cardinality N) fields in theCrossWorlds
business objects.Expansion of the business objects for Stockquote
ServiceRecall that one of the limitations of the SOAP Connector is that it
cannot sendmessages with arrays of simple types. Because of that limitation,
the symbolwithin the QuoteRequest was wrapped so that it could be passed as
an arrayof symbols in the message. An array of Strings cannot be represented
as abusiness-object attribute, but an array
ofcom.ibm.bct.ws.samples.QuoteRequest can.3. Open the BO definition
forMO_Client_BOtoSOAP_BCT_SOAP_StockQuoteService_getCompanyQuotes_Request_Re
trieve.Notice the BodyNS value. This is the single namespace that will be
used in theSOAP message. This is important to note, because when
WebSphereApplication Developer is used to produce a Web service, it uses
multiplenamespaces in the service deployment descriptor and WSDL that it
generates.For this sample, it used two namespaces, and only one can be
used.In the sample shown in the following screen, the namespace used
is(http://tempuri.org/com.ibm.bct.ws.samples.rpc.Stockquote). The namespace
isplaced into the meta-object definition and has to be changed on the
service sideas well. This is done by changing the deployment descriptor for
the service.8Web Services Advanced Topics
----------------------------------------------------------------------------
----
      Page 13
The BodyNS entry in the Attributes tab windowReviewing the deployment
descriptor fileLook at dds.xml under the Web application directory for the
deployed Web service.Look
under:Windows:<was_root>\installedapps\...UNIX:<was_root>/installedapps/...Y
ou see that there is a comment at the top of this file describing what was
done tothe deployment descriptor that WebSphere Application Developer
originallygenerated. Below are excerpts from the dds.xml file showing what
was done.<isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment"
id="http://tempuri.org/com.ibm.bct.ws.samples.rpc.Stockquote"
checkMustUnderstands="false">...<!-- Changed the namespace xmlns:x=
"http://www.stockquote.com/schemas/StockquoteRemoteInterface" --><!-- to be
the same as the above "id" value in the following 4 lines--> . .See the
actual dds.xml file for all of the changed lines.This provides the service
with only a single namespace, which is what is requiredif it is to be
invoked from the SOAP connector.Running the RPC sampleBe sure that the
WebSphere application server that hosts the RPC service is started.Also the
BCTSampleSOAPConnector and its agent process, BCTSampleConnector1,and the
RPC collaboration object must all be running.To run the sample service:1.
Bring up one Test Connector window.2. Open the BCTSampleConnector1
profile.3. Connect to the agent process.4. Load the saved business object
namedBCT_SOAP_StockquoteService_getCompanyQuotes1.5. Examine the business
object, as shown on the following screen:Advanced Topics9
----------------------------------------------------------------------------
----
      Page 14
Business object with two requests enteredIt is preloaded with two requests,
one for symbol IBM and one for GE. Thedate is pre-filled, but this will be
overwritten by the collaboration just beforesending the request to the SOAP
connector. The URL is pre-filled with theURL of the RPC service of the SOAP
server that you deployed for this sample.6. If you want, you can change the
symbols or add more symbols byright-clicking the requestQuoteList.7. Click
OK.8. Highlight the preloaded business object definition and send it.You
will see activity in the agent window, followed by a short pause, followedby
activity as the response comes back.9. Accept the response in the Test
Connector window.The response will appear in the right-hand pane of the Test
Connectorwindow.10. Double-click the response to examine it.11. Expand the
Response to see the details, as shown in the following screen.10Web Services
Advanced Topics
----------------------------------------------------------------------------
----
      Page 15
The results of the two requests (the stock prices)Compare the values to the
earlier ones (shown in step 5). Notice that:v The date has been updated.
This was done by the calling collaboration beforethe SOAP message was sent
to the Web service.v The quote values have been updated by the Web service.T
his document described how you can use the SOAP connector to send
RPCmessages to a non-CrossWorlds Web service. To learn more
aboutCrossWorlds-to-RPC flows, including how to develop them, see the Web
ServicesTechnical Reference.Advanced Topics11
----------------------------------------------------------------------------
----
      Page 16
12Web Services Advanced Topics
----------------------------------------------------------------------------
----
      Page 17
Routing filters and audit logsThis section explains concepts that you can
apply to enhance the BusinessConnection offering. After reading the
document, you can update the samplesshipped with Business Connection to
apply the concepts.Using a routing filterRecall that a Web Services Gateway
service can have more than one target serviceassociated with it. To uniquely
identify each target service, the GatewayAdministrator assigns a string
value, which can be a trading partner ID, to eachtarget service when more
than one is associated with a gateway service.The following screen (from a
sample Windows system) shows how a target servicewith an identifier of
TradingPartner-1068 has been added to a gateway service.You get to this
screen by listing the gateway services and clicking the link for oneof
them.Target Services screen with fields filled out for a new targetAfter two
more target services have been added to the gateway service, thegateway
service details screen shows the three target services:© Copyright IBM Corp.
200213
----------------------------------------------------------------------------
----
      Page 18
Target Services screen after new target has been addedTo use routing in the
Web Services Gateway, the message coming to the outboundchannel intended for
a particular trading partner must carry the destinationtrading partner ID in
it to specify the correct target service to invoke. The BusinessConnection
offering uses the SOAP message header to carry the target tradingpartner
ID.The CrossWorlds collaboration or a mapping can be used to fill in a SOAP
headerbusiness object with the destination trading partner ID before the
message is sentout through the SOAP connector. Business object
application-specific data is usedto specify that data carried by the generic
business object in a child business objectwill be placed in the header of
the SOAP message. The development proceduresdescribe how you do this.The
sample outbound collaboration object uses the SOAP header. Look at
theBCT_SOAP_BCT_TestAllTypes_Wrapper business object definition. This is the
typethat is actually used for the request by the SOAP connector. It includes
a childbusiness object named child that is of the type used by the generic
business objectBCT_TestAllTypes. The map from the collaboration To port to
theBCTSampleSOAPConnector fills in this child business object. The other
child of thebusiness object is named requestHeader. It has a child also,
named affiliate. Thesenames are arbitrary, but the application-specific data
for these two attributesdetermines that the SOAP data handler will place the
affiliate fields into the headerof the SOAP message rather than the body.For
your information, the requestHeader attribute has application-specific data
of:soap_location=SOAPHeader;type=BCT_SOAP_BCT_TestAllTypes_HDRThe affiliate
attribute has application-specific data
of:elem_ns=SOAPHeader;type=BCT_SOAP_BCT_TestAllTypes_HDRRefer to the
CrossWorlds Guide to using Web Services for detailed discussion of theheader
usage. For the purposes of this document, it is enough to understand thatthe
affiliate fields are placed into the header for use by the Web Services
Gateway,as shown in the following screen:14Web Services Advanced Topics
----------------------------------------------------------------------------
----
      Page 19
Attributes tab for requestHeaderThe figure below shows the flow of a SOAP
message that is routed by the WebServices Gateway based on the SOAP header
Destination ID:Web Services GatewayTradingPartner-1069Web Services
GatewayTradingPartner-1070Routing Filter:Gateway
service:BCT_TestAllTypes_RetrieveRequest filter is called1. Obtain
DestinationIDfrom SOAP header2. Select target serviceSOAP Messagewith
header(from CrossWorldsSOAP connector)Web Services
GatewayTradingPartner-1068Target service:TradingPartner-1069Target
service:TradingPartner-1068Target service:TradingPartner-1070Flow of a SOAP
message with header through the routing filterThe Web Services Gateway
allows Request and Response Filters to be deployed foreach gateway service.
For the specific purpose of routing in this sample, theRouting Filter used
by WebSphere Business Connection has been written to extractthe destination
trading partner ID value from the SOAP message header and isdeployed in the
Request Filter.This filter uses a Gateway API to select the correct target
service to receive the call.Note that the Routing Filter is provided in
bctwswsgwroutingfiltersoap.ear. If youdeploy it and then configure a gateway
service to use it as a Request Filter, it willread the SOAP header, look for
the affiliate element, and then read the name in theDestIDIdentifier field.
It will use this value to select the target service that has thatidentifier
value.Routing filters and audit logs15
----------------------------------------------------------------------------
----
      Page 20
Deploying and configuring a filterHere are the steps to manually deploy and
configure this filter. Note that whenyou install WebSphere Business
Connection using the instructions in the Installationand Configuration
Guide, this filter is automatically deployed and configured foryour use.1.
Display the Web Services Gateway Admin screen and select Filters.2. Click
Deploy.3. In the Filter name field, type:RoutingFilter4. In the Home
location field, type:BCTWSRoutingFilterSOAP5. Click OK.After deployment, the
filter will be available as a choice on the gateway servicescreen for either
a Request Filter or a Response Filter. If you want to use routing ofgateway
service requests to one of many target requests, you must add theRouting
Filter as a Request Filter for the gateway service.For the sample, you would
highlight the Routing Filter selection and then press theadd button, as
shown in the following screen:Flow of a SOAP message (with header) routed to
three targetsAfter adding it, you can remove it by using the same screen and
pressing theremove button.16Web Services Advanced Topics
----------------------------------------------------------------------------
----
      Page 21
Using the Business Connection Solution Manager Audit LogThis section
discusses how you can log incoming requests and responses for a
Webservice.If you check the Audit Policy check box labeled Log requests for
this service for agateway service (as shown in the following screen), the
Business Connectionoffering can use its Solution Manager component to save a
copy of the incomingrequests and responses for the service. The Solution
Manager Audit Log is used forthis purpose. A message queue is used to send
messages from the Web ServicesGateway machine to the Solution Manager Audit
Log.Gateway Service Properties screen with Log requests to this service
checkedNote that there are two other logs (the Business Log and the
Exception Log)maintained by the Solution Manager component. They are not
used by the WebServices Gateway component, so they are not discussed in this
document.For more information on using the Logging Client of the Solution
Manager, refer toUsing Business Connection APIs.Routing filters and audit
logs17
----------------------------------------------------------------------------
----
      Page 22
18Web Services Advanced Topics
----------------------------------------------------------------------------
----
      Page 23
Source Code for the RPC Sample ServiceThe source code for the classes that
comprise the RPC sample service is listedbelow for your
reference.QuoteRequest.javapackage com.ibm.bct.ws.samples.rpc;public class
QuoteRequest{private String symbol;/*** Gets the symbol* @return Returns a
String*/public String getSymbol() {return symbol;}/***Sets the symbol*
@param symbol The symbol to set*/public void setSymbol(String
symbol){this.symbol = symbol;}}QuoteResponse.javapackage
com.ibm.bct.ws.samples.rpc;public class QuoteResponse{private float
quote;private String symbol;/*** Gets the quote* @return Returns a
float*/public float getQuote() {return quote;}/***Sets the quote* @param
quote The quote to set*/public void setQuote(float quote){this.quote =
quote;}/*** Gets the symbol* @return Returns a String*/public String
getSymbol() {return symbol;}/**© Copyright IBM Corp. 200219
----------------------------------------------------------------------------
----
      Page 24
* Sets the symbol* @param symbol The symbol to set*/public void
setSymbol(String symbol){this.symbol = symbol;}}RequestList.javapackage
com.ibm.bct.ws.samples.rpc;public class RequestList{private String
date;private QuoteRequest[] requestQuoteList =new QuoteRequest[0];/*** Gets
the date* @return Returns a String*/public String getDate() {return
date;}/***Sets the date* @param date The date to set*/public void
setDate(String date){this.date = date;}/*** Gets the requestQuoteList*
@return Returns a QuoteRequest[]*/public QuoteRequest[]
getRequestQuoteList() {return requestQuoteList;}/***Sets the
requestQuoteList* @param requestQuoteList The requestQuoteList to
set*/public void
setRequestQuoteList(QuoteRequest[]requestQuoteList){this.requestQuoteList =
requestQuoteList;}}ResponseList.javapackage
com.ibm.bct.ws.samples.rpc;public class ResponseList{private String
date;private QuoteResponse[] responseQuoteList = newQuoteResponse[0];/***
Gets the date20Web Services Advanced Topics
----------------------------------------------------------------------------
----
      Page 25
* @return Returns a String*/public String getDate() {return date;}/***Sets
the date* @param date The date to set*/public void setDate(String
date){this.date = date;}/*** Gets the responseQuoteList* @return Returns a
QuoteResponse[]*/public QuoteResponse[] getResponseQuoteList() {return
responseQuoteList;}/***Sets the responseQuoteList* @param responseQuoteList
The responseQuoteList to set*/public void
setResponseQuoteList(QuoteResponse[]responseQuoteList){this.responseQuoteLis
t = responseQuoteList;}}Stockquote.javapackage
com.ibm.bct.ws.samples.rpc;import java.net.URL;import java.io.*;import
org.w3c.dom.*;import org.xml.sax.*;import javax.xml.parsers.*;//import
org.apache.soap.util.xml.*;import com.ibm.ras.*;import
com.ibm.bct.ws.trace.*;/*** This class is used to test the ability to use
complex* types and arrays of complex types for an rpc-style web* service
that is to be called using the CrossWorlds* SOAPConnector. Method
getCompanyQuotes(RequestList)* exercises this capability by involving
complex types* in the interface, which include arrays of other complex*
types.**/public class Stockquote{public static final float
CANNOT_OBTAIN_QUOTE = -1.0f;public static final float SYMBOL_LOOKUP_FAILED
= -2.0f;final static private String CLASSNAME =Source Code for the RPC
Sample Service21
----------------------------------------------------------------------------
----
      Page 26
Stockquote.class.getName();private static final RASTraceLogger m_traceLogger
=BCTWSTrace.createRASTraceLogger(BCTWSTraceConstants.BCT_ORG,BCTWSTraceConst
ants.BCT_PROD,BCTWSTraceConstants.BCT_COMP,Stockquote.class,BCTWSTraceConsta
nts.BCT_GROUPNAME);//TraceConstants.m_strGroupName);private static final
RASMessageLogger m_msgLogger
=BCTWSTrace.createRASMessageLogger(BCTWSTraceConstants.BCT_ORG,BCTWSTraceCon
stants.BCT_PROD,BCTWSTraceConstants.BCT_COMP,Stockquote.class,BCTWSTraceCons
tants.BCTMESSAGEFILE);private boolean islogging =
m_traceLogger.isLogging;//------// Obtain quotations for a list of symbols
passed// in a RequestList. Respond with a list of quotations// encapsulated
in a ResponseList.// Demonstrate some WAS tracing while we are at
it.//------public ResponseList getCompanyQuotes(RequestList reqList){if
(m_traceLogger.isLogging)m_traceLogger.entry(RASITraceEvent.TYPE_ENTRY_EXIT,
CLASSNAME,"getCompanyQuotes",new Object[]{});ResponseList respList = new
ResponseList();respList.setDate(new
java.util.Date().toString());QuoteRequest[] qreqlist
=reqList.getRequestQuoteList();QuoteResponse [] qresplist =
newQuoteResponse[qreqlist.length];for (int i=0; i<qreqlist.length; i++){//
Prepare the response arrayqresplist[i] = new
QuoteResponse();qresplist[i].setSymbol(qreqlist[i].getSymbol());float
quotation = SYMBOL_LOOKUP_FAILED;try{quotation =
getQuote(qreqlist[i].getSymbol());m_traceLogger.trace(RASITraceEvent.TYPE_AP
I,CLASSNAME,"getCompanyQuotes","Obtained quote for symbol<"
+qreqlist[i].getSymbol()+ "> :quotation = "+quotation);}catch (Throwable
t){quotation = CANNOT_OBTAIN_QUOTE;m_traceLogger.trace(22Web Services
Advanced Topics
----------------------------------------------------------------------------
----
      Page 27
RASITraceEvent.TYPE_API,CLASSNAME,"getCompanyQuotes","Caught exception
looking up symbol<" +qreqlist[i].getSymbol()+ "> :setting quotation = "
+quotation);}qresplist[i].setQuote(quotation);}// Put the response array
into the returning ResponseListrespList.setResponseQuoteList(qresplist);if
(m_traceLogger.isLogging)m_traceLogger.exit(RASITraceEvent.TYPE_ENTRY_EXIT,C
LASSNAME,"getCompanyQuotes",new Object[]{});return respList;}//------//
Obtain a single quotation for a symbol passed within a// wrapper class.
Demonstrate some WAS tracing while we are at it.//------public QuoteResponse
getCompanyQuote(QuoteRequest qr){if
(m_traceLogger.isLogging)m_traceLogger.entry(RASITraceEvent.TYPE_ENTRY_EXIT,
CLASSNAME,"getCompanyQuote",new Object[]{});QuoteResponse qresp = new
QuoteResponse();qresp.setSymbol(qr.getSymbol());float quotation =
SYMBOL_LOOKUP_FAILED;try{quotation =
getQuote(qr.getSymbol());m_traceLogger.trace(RASITraceEvent.TYPE_API,CLASSNA
ME,"getCompanyQuote","Obtained quote for symbol<" +qr.getSymbol()+ ">
:quotation = "+quotation);}catch (Throwable t){quotation =
CANNOT_OBTAIN_QUOTE;m_traceLogger.trace(RASITraceEvent.TYPE_API,CLASSNAME,
"getCompanyQuotes","Caught exception looking up symbol<" +qr.getSymbol()+ ">
:setting quotation = "+quotation);}qresp.setQuote(quotation);if
(m_traceLogger.isLogging)Source Code for the RPC Sample Service23
----------------------------------------------------------------------------
----
      Page 28
m_traceLogger.exit(RASITraceEvent.TYPE_ENTRY_EXIT,CLASSNAME,
"getCompanyQuote",new Object[]{});return qresp;}//------// Obtain quotations
for an array of symbols, returning an// array of floats.//------public
float[] getQuotes (String [] symbols){System.out.println
("Stockquote:getQuotes(String[])entry point called");float[] retArray = new
float[symbols.length];System.out.println
("Stockquote:getQuotes(String[])response: "); for (int i=0;
i<symbols.length; i++){float quotation = SYMBOL_LOOKUP_FAILED;try{quotation
= getQuote(symbols[i]);}catch (Throwable t){quotation =
CANNOT_OBTAIN_QUOTE;}retArray[i] = quotation;System.out.println("\t"
+symbols[i]+": "+quotation);}System.out.println
("Stockquote:getQuotes(String[])normal exit");return retArray;}//------//
Obtain a quotation from a public url service for a given// symbol. If
anything bad happens, just throw it back to// the caller.//------public
float getQuote(String symbol) throws
Exception{System.out.println("Stockquote:getQuote(String)entry point
 called");DocumentBuilderFactory factory
=DocumentBuilderFactory.newInstance();DocumentBuilder xdb =
factory.newDocumentBuilder();// get a real (delayed by 20min) stockquoteURL
url =new URL("http://www.xmltoday.com/examples/stockquote/24Web Services
Advanced Topics
----------------------------------------------------------------------------
----
      Page 29
getxmlquote.vep?s=" +
symbol);System.out.println("Stockquote:getQuote(String) opening input
streamwith URL: " + url);InputStream is =
url.openStream();System.out.println("Stockquote:getQuote(String) input
stream has beenobtained, parsing for price beginning");Document d =
xdb.parse(is);Element e = d.getDocumentElement();NodeList nl =
e.getElementsByTagName("price");e = (Element) nl.item(0);String quoteStr =
e.getAttribute("value");try{System.out.println("Stockquote:getQuote(String)
normalexit 1");return Float.valueOf(quoteStr).floatValue();}catch
(NumberFormatException e1){// Could it be an
int?try{System.out.println("Stockquote:getQuote(String)normal exit
 2");return Integer.valueOf(quoteStr).intValue()* 1.0F;}catch
(NumberFormatException
e2){System.out.println("Stockquote:getQuote(String)error exit
3");return -1.0F;}}} // end of method getQuote}Source Code for the RPC
Sample Service25
----------------------------------------------------------------------------
----
      Page 30
26Web Services Advanced Topics
----------------------------------------------------------------------------
----
      Page 31
NoticesIBM may not offer the products, services, or features discussed in
this document inall countries. Consult your local IBM representative for
information on theproducts and services currently available in your area.
Any reference to an IBMproduct, program, or service is not intended to state
or imply that only that IBMproduct, program, or service may be used. Any
functionally equivalent product,program, or service that does not infringe
any IBM intellectual property right maybe used instead. However, it is the
user's responsibility to evaluate and verify theoperation of any non-IBM
product, program, or service.IBM may have patents or pending patent
applications covering subject matterdescribed in this document. The
furnishing of this document does not give youany license to these patents.
You can send license inquiries, in writing, to:IBM Director of LicensingIBM
CorporationNorth Castle DriveArmonk, NY 10504-1785U.S.A.The following
paragraph does not apply to the United Kingdom or any othercountry where
such provisions are inconsistent with local law:INTERNATIONAL BUSINESS
MACHINES CORPORATION PROVIDES THISPUBLICATION?AS IS? WITHOUT WARRANTY OF ANY
KIND, EITHEREXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIEDWARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY OR FITNESSFOR A
PARTICULAR PURPOSE. Some states do not allow disclaimer of express orimplied
warranties in certain transactions, therefore, this statement may not
applyto you.This information could include technical inaccuracies or
typographical errors.Changes are periodically made to the information
herein; these changes will beincorporated in new editions of the
publication. IBM may make improvementsand/or changes in the product(s)
and/or program(s) described in this publicationat any time without
notice.Any references in this information to non-IBM Web sites are provided
forconvenience only and do not in any manner serve as an endorsement of
those Websites. The materials at those Web sites are not part of the
materials for this IBMproduct and use of those Web sites is at your own
risk.IBM may use or distribute any of the information you supply in any way
itbelieves appropriate without incurring any obligation to you.Licensees of
this program who wish to have information about it for the purposeof
enabling: (i) the exchange of information between independently
createdprograms and other programs (including this one) and (ii) the mutual
use of theinformation which has been exchanged, should contact:WebSphere
Business Connection Lab DirectorIBM RTP Laboratory3039 Cornwallis RoadP.O.
BOX 12195© Copyright IBM Corp. 200227
----------------------------------------------------------------------------
----
      Page 32
Raleigh, NC 27709-2195U.S.ASuch information may be available, subject to
appropriate terms and conditions,including in some cases, payment of a
fee.The licensed program described in this document and all licensed
materialavailable for it are provided by IBM under terms of the IBM Customer
Agreement,IBM International Program License Agreement, or any equivalent
agreementbetween us.Any performance data contained herein was determined in
a controlledenvironment. Therefore, the results obtained in other operating
environments mayvary significantly. Some measurements may have been made on
development-levelsystems and there is no guarantee that these measurements
will be the same ongenerally available systems. Furthermore, some
measurement may have beenestimated through extrapolation. Actual results may
vary. Users of this documentshould verify the applicable data for their
specific environment.Information concerning non-IBM products was obtained
from the suppliers ofthose products, their published announcements or other
publicly available sources.IBM has not tested those products and cannot
confirm the accuracy ofperformance, compatibility or any other claims
related to non-IBM products.Questions on the capabilities of non-IBM
products should be addressed to thesuppliers of those products.This
information contains examples of data and reports used in daily
businessoperations. To illustrate them as completely as possible, the
examples may includethe names of individuals, companies, brands, and
products. All of these names arefictitious and any similarity to the names
and addresses used by an actual businessenterprise is entirely
coincidental.All statements regarding IBM's future direction or intent are
subject to change orwithdrawal without notice, and represent goals and
objectives only.COPYRIGHT LICENSE:This information contains sample
application programs in source language, whichillustrates programming
techniques on various operating platforms. You may copy,modify, and
distribute these sample programs in any form without payment toIBM, for the
purposes of developing, using, marketing or distributing applicationprograms
conforming to the application programming interface for the
operatingplatform for which the sample programs are written. These examples
have notbeen thoroughly tested under all conditions. IBM, therefore, cannot
guarantee orimply reliability, serviceability, or function of these
programs. You may copy,modify, and distribute these sample programs in any
form without payment toIBM for the purposes of developing, using, marketing,
or distributing applicationprograms conforming to IBM's application
programming interfaces.Programming interface informationProgramming
interface information is intended to help you create applicationsoftware
using this program.General-use programming interfaces allow you to write
application software thatobtain the services of this program's tools.28Web
Services Advanced Topics
----------------------------------------------------------------------------
----
      Page 33
However, this information may also contain diagnosis, modification, and
tuninginformation. Diagnosis, modification and tuning information is
provided to helpyou debug your application software.Warning: Do not use this
diagnosis, modification, and tuning information as aprogramming interface
because it is subject to change.Trademarks and service marksThe following
terms are trademarks of International Business MachinesCorporation in the
United States, other countries, or both:IBMalphaWorksAIXCrossWorldsDB2DB2
OLAP ServerDB2 Universal
DatabaseDeveloperWorksMQSeriesSecureWayWebSphereLotus is a trademark of
International Business Machines Corporation and LotusDevelopment Corporation
in the United States, other countries, or both.Java and all Java-based
trademarks are trademarks of Sun Microsystems, Inc. in theUnited States,
other countries, or both.Microsoft, Windows, Windows NT, and the Windows
logo are trademarks ofMicrosoft Corporation in the United States, other
countries, or both.MMX, Pentium and ProShare are trademarks of Intel
Corporation in the UnitedStates, other countries, or both.Other company,
product or service names may be trademarks or service marks
ofothers.Notices29The following illustration shows a document-style message
arriving at themessagerouter URL and an RPC-style message arriving at the
rpcrouter URL.Document-styleRPC-styleApplicationserverService. Includes code
toparse contents ofSOAP messagemessagerouterSOAPmessage
bodyApplicationserverService. Expects a certainnumber and orderof message
partsrpcrouterSOAPmessage partSOAP message going to messagerouter
(document-style) or rpcrouter (RPC-style)A SOAP connector exampleFor direct
CrossWorlds-to-CrossWorlds connectivity, the SOAP connector creates
adocument-style SOAP message. This message is sent to the messagerouter URL
ofthe application server that hosts the CrossWorlds proxy class. An
exampledocument-style message sent from the SOAP connector is shown
below:Advanced Topics3
----------------------------------------------------------------------------
----
      Page 8
<?xml version='1.0' encoding='UTF-8'?><SOAP-ENV:Envelope xmlns:SOAP-ENV=
"http://schemas.xmlsoap.org/soap/envelope/"xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance" SOAP-ENV:encodingStyle=
"http://schemas.xmlsoap.org/soap/encoding/"xmlns:xsd=
"http://www.w3.org/2001/XMLSchema"><SOAP-ENV:Header><hns0:affiliate
xmlns:hns0="http://www.ibm.com/wbc"
><DestIDIdentifier>stevesh</DestIDIdentifier><DestIDType>PartnerName</DestID
Type></hns0:affiliate></SOAP-ENV:Header><SOAP-ENV:Body><ns1:m_BCT_DocStyleTe
st xmlns:ns1="urn:ibmwsgw#BCT_DocStyleTest_Retrieve"><child>
<field1>true</field1><field2>1</field2><field3>1.1</field3><field4>1E2</fiel
d4><field5>string1</field5><field6>2002-05-14T19:26:00Z</field6><field7>long
text
1</field7></child></ns1:m_BCT_DocStyleTest></SOAP-ENV:Body></SOAP-ENV:Envelo
pe>Notice the bold part of the message. This is where the CrossWorlds data
handlerplaces the data fields from the generic business object in the SOAP
message. If youlook at the data for the fields, you have some sense of their
data type, but there isnothing to tell the service that handles the message
anything about the data types.This message will be read by the messagerouter
servlet, and the contents of theSOAP-Env:Body will be passed to the service
whose ID is named in the Bodynamespace of the message
(urn:ibmwsgw#BCT_DocStyleTest_Retrieve). Themethod specified by the Body
name of the message Body will be called for thisservice ID (that is, method
name m_BCT_DocStyleTest will be called).For document-style services, the
service methods all have the same parameter list.One of the parameters is
the SOAP Envelope. The messagerouter creates aninstance of
org.apache.soap.Envelope using the message contents. It passes theEnvelope
to the service method, which must include code to parse it appropriatelyand
process the contents.RPC message semanticsRecall that the RPC model mimics a
method call using a SOAP message. Themessage encapsulates the parameters for
the call in its Body. The order and type ofthe parameters must match the
parameter list of the service Java method to invoke.RPC messages are sent to
the rpcrouter URL of the SOAP application server ratherthan the
messagerouter URL. The rpcrouter takes the contents of the SOAPEnvelope and
creates an instance of a Java type for each message part. These Javaobjects
are used as parameters to invoke a method on a Java class. Remember thatthe
method name is the SOAP message Body part name, and the class name isfound
by the ID of the service, which is the SOAP message Body namespace.For the
rpcrouter to know the proper types of the parameters, the RPC-stylemessage
has to include type information along with each part in the message.4Web
Services Advanced Topics
----------------------------------------------------------------------------
----
      Page 9
Using the SOAP Connector to send RPC-style messagesThe CrossWorlds SOAP
connector can be configured via the meta-objects it uses tosend messages
that use RPC-style semantics. This allows you to call Web servicesthat
expect RPC-style SOAP messages.To configure the use of RPC-style semantics,
you set the value of the TypeInfo fieldin the BOtoSOAP client meta-object
for your SOAP request application-specificbusiness object to the value true.
The following screen shows TypeInfo set to true.Attributes tab with TypeInfo
field set to trueThe resulting SOAP message issued by the SOAP connector now
has RPCsemantics, as you can see by the type information in each field in
the followingexample message:<?xml version='1.0' encoding='UTF-8'
?><SOAP-ENV:Envelope xmlns:SOAP-ENV=
"http://schemas.xmlsoap.org/soap/envelope/"xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance" SOAP-ENV:encodingStyle=
"http://schemas.xmlsoap.org/soap/encoding/"xmlns:xsd=
"http://www.w3.org/2001/XMLSchema"><SOAP-ENV:Header><hns0:affiliate
xmlns:hns0="http://www.ibm.com/wbc"
><DestIDIdentifier>stevesh</DestIDIdentifier><DestIDType>PartnerName</DestID
Type></hns0:affiliate></SOAP-ENV:Header><SOAP-ENV:Body><ns1:m_BCT_RPCStyleTe
st xmlns:ns1="urn:ibmwsgw#BCT_RPCStyleTest_Retrieve"><child xsi:type=
"ns1:BCT_RPCStyleTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
><field1 xsi:type="xsd:boolean">true</field1><field2 xsi:type="xsd:int"
>1</field2><field3 xsi:type="xsd:float">1.1</field3><field4 xsi:type=
"xsd:double">1E2</field4><field5 xsi:type="xsd:string"
>string1</field5><field6 xsi:type="xsd:dateTime"
>2002-05-14T19:26:00Z</field6><field7 xsi:type="xsd:string">long text
1</field7></child></ns1:m_BCT_RPCStyleTest></SOAP-ENV:Body></SOAP-ENV:Envelo
pe>The bold part of the message text has type information that is used by
therpcrouter when it builds the parameter list.Advanced Topics5
----------------------------------------------------------------------------
----
      Page 10
Web Services Gateway messagesSOAP messages that are processed by the Web
Services Gateway must use RPCsemantics. The channels used by the Business
Connection offering are based on theSOAP rpcrouter servlet, so for the Web
Services Gateway to correctly processmessages sent to a SOAP channel, the
messages must include type information.The CWGenUtility provided by the
Business Connection offering to produce theCrossWorlds artifacts for a Web
service produces meta-object definitions with theTypeInfo field set to true
where it is appropriate. This means that the SOAPconnector will produce
messages that can be processed by the Web ServicesGateway channels.SOAP
connector limitationsFor an RPC-style Web service to be called by the SOAP
Connector, theselimitations must be accommodated:v Only a single namespace
can be used by the body of the message and all of itsparts.v Only some data
types may be present in the Web-service interface. These includestring,
integer, float, double, and the other simple types supported by
theCrossWorlds Business Object Designer. Commonly used Java classes such
asVector and Hashtable, however, may not be used in the interface to a
Webservice if it is to be called from the SOAP Connector.v Complex types
containing zero or more attributes of a simple type (asmentioned above) and
zero or more attributes of a complex type are allowed.v Arrays must be
composed of complex types, not simple types.These limitations are mainly
derived from the fact that business objects are used toform the message that
is sent by the SOAP connector. Any data in the messagemust have a
CrossWorlds data type. Because CrossWorlds arrays (N-cardinalitychildren)
must be composed of business objects and not of simple types, anyarrays in
the Web-service interface must be arrays of complex types.The RPC Sample
ScenarioAn example of a Java Web service developed using WebSphere
ApplicationDeveloper that is called from a collaboration via the SOAP
connector is providedwith the Business Connection offering. The theme of
this sample is an expandedversion of the common Stock Quote service.The
sample allows you to enter a list of one or more stock symbols as an array
ofbusiness objects. This list is sent as a SOAP message via the SOAP
connector to therpcrouter URL of a SOAP-enabled application server deployed
in WebSphere. TheWeb service that processes the request, which was created
with WebSphereApplication Developer, is deployed in the sample application
server. The rpcrouterservlet forms a method call from the message and calls
the service class. If theserver has connectivity to http://www.xmltoday.com,
a quote for each symbol inthe request list will be obtained. If there is no
connectivity, a list is returned witherror values (-1.0) in the quote
response fields. The response list is sent backsynchronously to the
caller.6Web Services Advanced Topics
----------------------------------------------------------------------------
----
      Page 11
Installing the RPC service in WebSphereThe RPC Stockquote service is
provided in a SOAP-enabled EAR file.To install the RPC service:1. Bring up
your WebSphere Admin Console.2. Install bctwssamplesrpc.ear into an
application server of your choice (thedefault server, for example). Do not
install the EAR file into the Web ServicesGateway App Server.3. Regenerate
the Web server plug-in, stop the application server (if it is running),and
then restart (or start) the application server where you installed the
EARfile.Reviewing the Java code for the Web serviceThe source code for the
classes used by the sample service is included at the endof this document.
Look at the following classes that are used by the service:v
com.ibm.bct.ws.samples.rpc.QuoteRequest:Encapsulates a String field named
symbol to carry a request for a single quote.v
com.ibm.bct.ws.samples.rpc.QuoteResponse:Encapsulates two String fields
named symbol and quote to carry a singlequotation back to the caller.v
com.ibm.bct.ws.samples.rpc.RequestList:Encapsulates a String field named
date and an array of QuoteRequest objects.This is the request type for the
StockQuote getCompanyQuotes(RequestList)method.v
com.ibm.bct.ws.samples.rpc.ResponseList:Encapsulates a String field named
date and an array of QuoteResponse objects.This the return type for the
getCompanyQuotes(RequestList) method.v
com.ibm.bct.ws.samples.rpc.Stockquote:This is the class which provides the
getCompanyQuotes(RequestList) method.This is the Web service
implementation.Installing the sample CrossWorlds codeTo install the code:1.
Refer to the CrossWorlds Samples section of the Web Services Overview
andSamples and import the Business Connection sample CrossWorlds data if
youhave not already done so.2. Before running the sample, you will need to
compile the collaboration templatenamed StockQuoteServiceOutbound.3. After
you have done this, stop and restart the ICS.4. Check the system view to be
sure that the collaboration object
namedBCT_SampleConnector1_to_BCT_SampleSOAPConnector_StockQuoteServiceOutbou
nd has started.5. Also make sure the BCT_SampleSOAPConnector has started.
You can checkthat the connector controller is started by viewing the System
View window.You also need to start the connector agent for this connector.
Refer to the WebServices Overview and Samples document to review how this is
done.6. Look at the collaboration template and the collaboration object.
They are similarto the previousBCT_TestAllTypesOutbound sample.Advanced
Topics7
----------------------------------------------------------------------------
----
      Page 12
Because this sample calls out from CrossWorlds to a Java RPC Web service,
there isno inbound collaboration.Reviewing the business objectsTo review the
business object:1. Open the StockquoteService folder in the CrossWorlds
BCT_WS_Samplesproject.2. Look at the business object definitions for this
service.In addition to the SOAP meta-objects for sending a message via the
SOAPconnector, there are also some business objects that have names
resembling thefour interface classes used by the StockQuote RPC Web service.
The businessobjects are shown in the screen below.If you open these business
objects, you can see that they have attributes thatcorrespond to the fields
of the Java classes. In particular, notice that the arraysof the Java
classes have corresponding arrays (cardinality N) fields in theCrossWorlds
business objects.Expansion of the business objects for Stockquote
ServiceRecall that one of the limitations of the SOAP Connector is that it
cannot sendmessages with arrays of simple types. Because of that limitation,
the symbolwithin the QuoteRequest was wrapped so that it could be passed as
an arrayof symbols in the message. An array of Strings cannot be represented
as abusiness-object attribute, but an array
ofcom.ibm.bct.ws.samples.QuoteRequest can.3. Open the BO definition
forMO_Client_BOtoSOAP_BCT_SOAP_StockQuoteService_getCompanyQuotes_Request_Re
trieve.Notice the BodyNS value. This is the single namespace that will be
used in theSOAP message. This is important to note, because when
WebSphereApplication Developer is used to produce a Web service, it uses
multiplenamespaces in the service deployment descriptor and WSDL that it
generates.For this sample, it used two namespaces, and only one can be
used.In the sample shown in the following screen, the namespace used
is(http://tempuri.org/com.ibm.bct.ws.samples.rpc.Stockquote). The namespace
isplaced into the meta-object definition and has to be changed on the
service sideas well. This is done by changing the deployment descriptor for
the service.8Web Services Advanced Topics
----------------------------------------------------------------------------
----
      Page 13
The BodyNS entry in the Attributes tab windowReviewing the deployment
descriptor fileLook at dds.xml under the Web application directory for the
deployed Web service.Look
under:Windows:<was_root>\installedapps\...UNIX:<was_root>/installedapps/...Y
ou see that there is a comment at the top of this file describing what was
done tothe deployment descriptor that WebSphere Application Developer
originallygenerated. Below are excerpts from the dds.xml file showing what
was done.<isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment"
id="http://tempuri.org/com.ibm.bct.ws.samples.rpc.Stockquote"
checkMustUnderstands="false">...<!-- Changed the namespace xmlns:x=
"http://www.stockquote.com/schemas/StockquoteRemoteInterface" --><!-- to be
the same as the above "id" value in the following 4 lines--> . .See the
actual dds.xml file for all of the changed lines.This provides the service
with only a single namespace, which is what is requiredif it is to be
invoked from the SOAP connector.Running the RPC sampleBe sure that the
WebSphere application server that hosts the RPC service is started.Also the
BCTSampleSOAPConnector and its agent process, BCTSampleConnector1,and the
RPC collaboration object must all be running.To run the sample service:1.
Bring up one Test Connector window.2. Open the BCTSampleConnector1
profile.3. Connect to the agent process.4. Load the saved business object
namedBCT_SOAP_StockquoteService_getCompanyQuotes1.5. Examine the business
object, as shown on the following screen:Advanced Topics9
----------------------------------------------------------------------------
----
      Page 14
Business object with two requests enteredIt is preloaded with two requests,
one for symbol IBM and one for GE. Thedate is pre-filled, but this will be
overwritten by the collaboration just beforesending the request to the SOAP
connector. The URL is pre-filled with theURL of the RPC service of the SOAP
server that you deployed for this sample.6. If you want, you can change the
symbols or add more symbols byright-clicking the requestQuoteList.7. Click
OK.8. Highlight the preloaded business object definition and send it.You
will see activity in the agent window, followed by a short pause, followedby
activity as the response comes back.9. Accept the response in the Test
Connector window.The response will appear in the right-hand pane of the Test
Connectorwindow.10. Double-click the response to examine it.11. Expand the
Response to see the details, as shown in the following screen.10Web Services
Advanced Topics
----------------------------------------------------------------------------
----
      Page 15
The results of the two requests (the stock prices)Compare the values to the
earlier ones (shown in step 5). Notice that:v The date has been updated.
This was done by the calling collaboration beforethe SOAP message was sent
to the Web service.v The quote values have been updated by the Web
service.This document described how you can use the SOAP connector to send
RPCmessages to a non-CrossWorlds Web service. To learn more
aboutCrossWorlds-to-RPC flows, including how to develop them, see the Web
ServicesTechnical Reference.Advanced Topics11
----------------------------------------------------------------------------
----
      Page 16
12Web Services Advanced Topics
----------------------------------------------------------------------------
----
      Page 17
Routing filters and audit logsThis section explains concepts that you can
apply to enhance the BusinessConnection offering. After reading the
document, you can update the samplesshipped with Business Connection to
apply the concepts.Using a routing filterRecall that a Web Services Gateway
service can have more than one target serviceassociated with it. To uniquely
identify each target service, the GatewayAdministrator assigns a string
value, which can be a trading partner ID, to eachtarget service when more
than one is associated with a gateway service.The following screen (from a
sample Windows system) shows how a target servicewith an identifier of
TradingPartner-1068 has been added to a gateway service.You get to this
screen by listing the gateway services and clicking the link for oneof
them.Target Services screen with fields filled out for a new targetAfter two
more target services have been added to the gateway service, thegateway
service details screen shows the three target services:© Copyright IBM Corp.
200213
----------------------------------------------------------------------------
----
      Page 18
Target Services screen after new target has been addedTo use routing in the
Web Services Gateway, the message coming to the outboundchannel intended for
a particular trading partner must carry the destinationtrading partner ID in
it to specify the correct target service to invoke. The BusinessConnection
offering uses the SOAP message header to carry the target tradingpartner
ID.The CrossWorlds collaboration or a mapping can be used to fill in a SOAP
headerbusiness object with the destination trading partner ID before the
message is sentout through the SOAP connector. Business object
application-specific data is usedto specify that data carried by the generic
business object in a child business objectwill be placed in the header of
the SOAP message. The development proceduresdescribe how you do this.The
sample outbound collaboration object uses the SOAP header. Look at
theBCT_SOAP_BCT_TestAllTypes_Wrapper business object definition. This is the
typethat is actually used for the request by the SOAP connector. It includes
a childbusiness object named child that is of the type used by the generic
business objectBCT_TestAllTypes. The map from the collaboration To port to
theBCTSampleSOAPConnector fills in this child business object. The other
child of thebusiness object is named requestHeader. It has a child also,
named affiliate. Thesenames are arbitrary, but the application-specific data
for these two attributesdetermines that the SOAP data handler will place the
affiliate fields into the headerof the SOAP message rather than the body.For
your information, the requestHeader attribute has application-specific data
of:soap_location=SOAPHeader;type=BCT_SOAP_BCT_TestAllTypes_HDRThe affiliate
attribute has application-specific data
of:elem_ns=SOAPHeader;type=BCT_SOAP_BCT_TestAllTypes_HDRRefer to the
CrossWorlds Guide to using Web Services for detailed discussion of theheader
usage. For the purposes of this document, it is enough to understand thatthe
affiliate fields are placed into the header for use by the Web Services
Gateway,as shown in the following screen:14Web Services Advanced Topics
----------------------------------------------------------------------------
----
      Page 19
Attributes tab for requestHeaderThe figure below shows the flow of a SOAP
message that is routed by the WebServices Gateway based on the SOAP header
Destination ID:Web Services GatewayTradingPartner-1069Web Services
GatewayTradingPartner-1070Routing Filter:Gateway
service:BCT_TestAllTypes_RetrieveRequest filter is called1. Obtain
DestinationIDfrom SOAP header2. Select target serviceSOAP Messagewith
header(from CrossWorldsSOAP connector)Web Services
GatewayTradingPartner-1068Target service:TradingPartner-1069Target
service:TradingPartner-1068Target service:TradingPartner-1070Flow of a SOAP
message with header through the routing filterThe Web Services Gateway
allows Request and Response Filters to be deployed foreach gateway service.
For the specific purpose of routing in this sample, theRouting Filter used b
y WebSphere Business Connection has been written to extractthe destination
trading partner ID value from the SOAP message header and isdeployed in the
Request Filter.This filter uses a Gateway API to select the correct target
service to receive the call.Note that the Routing Filter is provided in
bctwswsgwroutingfiltersoap.ear. If youdeploy it and then configure a gateway
service to use it as a Request Filter, it willread the SOAP header, look for
the affiliate element, and then read the name in theDestIDIdentifier field.
It will use this value to select the target service that has thatidentifier
value.Routing filters and audit logs15
----------------------------------------------------------------------------
----
      Page 20
Deploying and configuring a filterHere are the steps to manually deploy and
configure this filter. Note that whenyou install WebSphere Business
Connection using the instructions in the Installationand Configuration
Guide, this filter is automatically deployed and configured foryour use.1.
Display the Web Services Gateway Admin screen and select Filters.2. Click
Deploy.3. In the Filter name field, type:RoutingFilter4. In the Home
location field, type:BCTWSRoutingFilterSOAP5. Click OK.After deployment, the
filter will be available as a choice on the gateway servicescreen for either
a Request Filter or a Response Filter. If you want to use routing ofgateway
service requests to one of many target requests, you must add theRouting
Filter as a Request Filter for the gateway service.For the sample, you would
highlight the Routing Filter selection and then press theadd button, as
shown in the following screen:Flow of a SOAP message (with header) routed to
three targetsAfter adding it, you can remove it by using the same screen and
pressing theremove button.16Web Services Advanced Topics
----------------------------------------------------------------------------
----
      Page 21
Using the Business Connection Solution Manager Audit LogThis section
discusses how you can log incoming requests and responses for a
Webservice.If you check the Audit Policy check box labeled Log requests for
this service for agateway service (as shown in the following screen), the
Business Connectionoffering can use its Solution Manager component to save a
copy of the incomingrequests and responses for the service. The Solution
Manager Audit Log is used forthis purpose. A message queue is used to send
messages from the Web ServicesGateway machine to the Solution Manager Audit
Log.Gateway Service Properties screen with Log requests to this service
checkedNote that there are two other logs (the Business Log and the
Exception Log)maintained by the Solution Manager component. They are not
used by the WebServices Gateway component, so they are not discussed in this
document.For more information on using the Logging Client of the Solution
Manager, refer toUsing Business Connection APIs.Routing filters and audit
logs17
----------------------------------------------------------------------------
----
      Page 22
18Web Services Advanced Topics
----------------------------------------------------------------------------
----
      Page 23
Source Code for the RPC Sample ServiceThe source code for the classes that
comprise the RPC sample service is listedbelow for your
reference.QuoteRequest.javapackage com.ibm.bct.ws.samples.rpc;public class
QuoteRequest{private String symbol;/*** Gets the symbol* @return Returns a
String*/public String getSymbol() {return symbol;}/***Sets the symbol*
@param symbol The symbol to set*/public void setSymbol(String
symbol){this.symbol = symbol;}}QuoteResponse.javapackage
com.ibm.bct.ws.samples.rpc;public class QuoteResponse{private float
quote;private String symbol;/*** Gets the quote* @return Returns a
float*/public float getQuote() {return quote;}/***Sets the quote* @param
quote The quote to set*/public void setQuote(float quote){this.quote =
quote;}/*** Gets the symbol* @return Returns a String*/public String
getSymbol() {return symbol;}/**© Copyright IBM Corp. 200219
----------------------------------------------------------------------------
----
      Page 24
* Sets the symbol* @param symbol The symbol to set*/public void
setSymbol(String symbol){this.symbol = symbol;}}RequestList.javapackage
com.ibm.bct.ws.samples.rpc;public class RequestList{private String
date;private QuoteRequest[] requestQuoteList =new QuoteRequest[0];/*** Gets
the date* @return Returns a String*/public String getDate() {return
date;}/***Sets the date* @param date The date to set*/public void
setDate(String date){this.date = date;}/*** Gets the requestQuoteList*
@return Returns a QuoteRequest[]*/public QuoteRequest[]
getRequestQuoteList() {return requestQuoteList;}/***Sets the
requestQuoteList* @param requestQuoteList The requestQuoteList to
set*/public void
setRequestQuoteList(QuoteRequest[]requestQuoteList){this.requestQuoteList =
requestQuoteList;}}ResponseList.javapackage
com.ibm.bct.ws.samples.rpc;public class ResponseList{private String
date;private QuoteResponse[] responseQuoteList = newQuoteResponse[0];/***
Gets the date20Web Services Advanced Topics
----------------------------------------------------------------------------
----
      Page 25
* @return Returns a String*/public String getDate() {return date;}/***Sets
the date* @param date The date to set*/public void setDate(String
date){this.date = date;}/*** Gets the responseQuoteList* @return Returns a
QuoteResponse[]*/public QuoteResponse[] getResponseQuoteList() {return
responseQuoteList;}/***Sets the responseQuoteList* @param responseQuoteList
The responseQuoteList to set*/public void
setResponseQuoteList(QuoteResponse[]responseQuoteList){this.responseQuoteLis
t = responseQuoteList;}}Stockquote.javapackage
com.ibm.bct.ws.samples.rpc;import java.net.URL;import java.io.*;import
org.w3c.dom.*;import org.xml.sax.*;import javax.xml.parsers.*;//import
org.apache.soap.util.xml.*;import com.ibm.ras.*;import
com.ibm.bct.ws.trace.*;/*** This class is used to test the ability to use
complex* types and arrays of complex types for an rpc-style web* service
that is to be called using the CrossWorlds* SOAPConnector. Method
getCompanyQuotes(RequestList)* exercises this capability by involving
complex types* in the interface, which include arrays of other complex*
types.**/public class Stockquote{public static final float
CANNOT_OBTAIN_QUOTE = -1.0f;public static final float SYMBOL_LOOKUP_FAILED
= -2.0f;final static private String CLASSNAME =Source Code for the RPC
Sample Service21
----------------------------------------------------------------------------
----
      Page 26
Stockquote.class.getName();private static final RASTraceLogger m_traceLogger
=BCTWSTrace.createRASTraceLogger(BCTWSTraceConstants.BCT_ORG,BCTWSTraceConst
ants.BCT_PROD,BCTWSTraceConstants.BCT_COMP,Stockquote.class,BCTWSTraceConsta
nts.BCT_GROUPNAME);//TraceConstants.m_strGroupName);private static final
RASMessageLogger m_msgLogger
=BCTWSTrace.createRASMessageLogger(BCTWSTraceConstants.BCT_ORG,BCTWSTraceCon
stants.BCT_PROD,BCTWSTraceConstants.BCT_COMP,Stockquote.class,BCTWSTraceCons
tants.BCTMESSAGEFILE);private boolean islogging =
m_traceLogger.isLogging;//------// Obtain quotations for a list of symbols
passed// in a RequestList. Respond with a list of quotations// encapsulated
in a ResponseList.// Demonstrate some WAS tracing while we are at
it.//------public ResponseList getCompanyQuotes(RequestList reqList){if
(m_traceLogger.isLogging)m_traceLogger.entry(RASITraceEvent.TYPE_ENTRY_EXIT,
CLASSNAME,"getCompanyQuotes",new Object[]{});ResponseList respList = new
ResponseList();respList.setDate(new
java.util.Date().toString());QuoteRequest[] qreqlist
=reqList.getRequestQuoteList();QuoteResponse [] qresplist =
newQuoteResponse[qreqlist.length];for (int i=0; i<qreqlist.length; i++){//
Prepare the response arrayqresplist[i] = new
QuoteResponse();qresplist[i].setSymbol(qreqlist[i].getSymbol());float
quotation = SYMBOL_LOOKUP_FAILED;try{quotation =
getQuote(qreqlist[i].getSymbol());m_traceLogger.trace(RASITraceEvent.TYPE_AP
I,CLASSNAME,"getCompanyQuotes","Obtained quote for symbol<"
+qreqlist[i].getSymbol()+ "> :quotation = "+quotation);}catch (Throwable
t){quotation = CANNOT_OBTAIN_QUOTE;m_traceLogger.trace(22Web Services
Advanced Topics
----------------------------------------------------------------------------
----
      Page 27
RASITraceEvent.TYPE_API,CLASSNAME,"getCompanyQuotes","Caught exception
looking up symbol<" +qreqlist[i].getSymbol()+ "> :setting quotation = "
+quotation);}qresplist[i].setQuote(quotation);}// Put the response array
into the returning ResponseListrespList.setResponseQuoteList(qresplist);if
(m_traceLogger.isLogging)m_traceLogger.exit(RASITraceEvent.TYPE_ENTRY_EXIT,C
LASSNAME,"getCompanyQuotes",new Object[]{});return respList;}//------//
Obtain a single quotation for a symbol passed within a// wrapper class.
Demonstrate some WAS tracing while we are at it.//------public QuoteResponse
getCompanyQuote(QuoteRequest qr){if
(m_traceLogger.isLogging)m_traceLogger.entry(RASITraceEvent.TYPE_ENTRY_EXIT,
CLASSNAME,"getCompanyQuote",new Object[]{});QuoteResponse qresp = new
QuoteResponse();qresp.setSymbol(qr.getSymbol());float quotation =
SYMBOL_LOOKUP_FAILED;try{quotation =
getQuote(qr.getSymbol());m_traceLogger.trace(RASITraceEvent.TYPE_API,CLASSNA
ME,"getCompanyQuote","Obtained quote for symbol<" +qr.getSymbol()+ ">
:quotation = "+quotation);}catch (Throwable t){quotation =
CANNOT_OBTAIN_QUOTE;m_traceLogger.trace(RASITraceEvent.TYPE_API,CLASSNAME,
"getCompanyQuotes","Caught exception looking up symbol<" +qr.getSymbol()+ ">
:setting quotation = "+quotation);}qresp.setQuote(quotation);if
(m_traceLogger.isLogging)Source Code for the RPC Sample Service23
----------------------------------------------------------------------------
----
      Page 28
m_traceLogger.exit(RASITraceEvent.TYPE_ENTRY_EXIT,CLASSNAME,
"getCompanyQuote",new Object[]{});return qresp;}//------// Obtain quotations
for an array of symbols, returning an// array of floats.//------public
float[] getQuotes (String [] symbols){System.out.println
("Stockquote:getQuotes(String[])entry point called");float[] retArray = new
float[symbols.length];System.out.println
("Stockquote:getQuotes(String[])response: "); for (int i=0;
i<symbols.length; i++){float quotation = SYMBOL_LOOKUP_FAILED;try{quotation
= getQuote(symbols[i]);}catch (Throwable t){quotation =
CANNOT_OBTAIN_QUOTE;}retArray[i] = quotation;System.out.println("\t"
+symbols[i]+": "+quotation);}System.out.println
("Stockquote:getQuotes(String[])normal exit");return retArray;}//------//
Obtain a quotation from a public url service for a given// symbol. If
anything bad happens, just throw it back to// the caller.//------public
float getQuote(String symbol) throws
Exception{System.out.println("Stockquote:getQuote(String)entry point
 called");DocumentBuilderFactory factory
=DocumentBuilderFactory.newInstance();DocumentBuilder xdb =
factory.newDocumentBuilder();// get a real (delayed by 20min) stockquoteURL
url =new URL("http://www.xmltoday.com/examples/stockquote/24Web Services
Advanced Topics
----------------------------------------------------------------------------
----
      Page 29
getxmlquote.vep?s=" +
symbol);System.out.println("Stockquote:getQuote(String) opening input
streamwith URL: " + url);InputStream is =
url.openStream();System.out.println("Stockquote:getQuote(String) input
stream has beenobtained, parsing for price beginning");Document d =
xdb.parse(is);Element e = d.getDocumentElement();NodeList nl =
e.getElementsByTagName("price");e = (Element) nl.item(0);String quoteStr =
e.getAttribute("value");try{System.out.println("Stockquote:getQuote(String)
normalexit 1");return Float.valueOf(quoteStr).floatValue();}catch
(NumberFormatException e1){// Could it be an
int?try{System.out.println("Stockquote:getQuote(String)normal exit
 2");return Integer.valueOf(quoteStr).intValue()* 1.0F;}catch
(NumberFormatException
e2){System.out.println("Stockquote:getQuote(String)error exit
3");return -1.0F;}}} // end of method getQuote}Source Code for the RPC
Sample Service25
----------------------------------------------------------------------------
----
      Page 30
26Web Services Advanced Topics
----------------------------------------------------------------------------
----
      Page 31
NoticesIBM may not offer the products, services, or features discussed in
this document inall countries. Consult your local IBM representative for
information on theproducts and services currently available in your area.
Any reference to an IBMproduct, program, or service is not intended to state
or imply that only that IBMproduct, program, or service may be used. Any
functionally equivalent product,program, or service that does not infringe
any IBM intellectual property right maybe used instead. However, it is the
user's responsibility to evaluate and verify theoperation of any non-IBM
product, program, or service.IBM may have patents or pending patent
applications covering subject matterdescribed in this document. The
furnishing of this document does not give youany license to these patents.
You can send license inquiries, in writing, to:IBM Director of LicensingIBM
CorporationNorth Castle DriveArmonk, NY 10504-1785U.S.A.The following
paragraph does not apply to the United Kingdom or any othercountry where
such provisions are inconsistent with local law:INTERNATIONAL BUSINESS
MACHINES CORPORATION PROVIDES THISPUBLICATION?AS IS? WITHOUT WARRANTY OF ANY
KIND, EITHEREXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIEDWARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY OR FITNESSFOR A
PARTICULAR PURPOSE. Some states do not allow disclaimer of express orimplied
warranties in certain transactions, therefore, this statement may not
applyto you.This information could include technical inaccuracies or
typographical errors.Changes are periodically made to the information
herein; these changes will beincorporated in new editions of the
publication. IBM may make improvementsand/or changes in the product(s)
and/or program(s) described in this publicationat any time without
notice.Any references in this information to non-IBM Web sites are provided
forconvenience only and do not in any manner serve as an endorsement of
those Websites. The materials at those Web sites are not part of the
materials for this IBMproduct and use of those Web sites is at your own
risk.IBM may use or distribute any of the information you supply in any way
itbelieves appropriate without incurring any obligation to you.Licensees of
this program who wish to have information about it for the purposeof
enabling: (i) the exchange of information between independently
createdprograms and other programs (including this one) and (ii) the mutual
use of theinformation which has been exchanged, should contact:WebSphere
Business Connection Lab DirectorIBM RTP Laboratory3039 Cornwallis RoadP.O.
BOX 12195© Copyright IBM Corp. 200227
----------------------------------------------------------------------------
----
      Page 32
Raleigh, NC 27709-2195U.S.ASuch information may be available, subject to
appropriate terms and conditions,including in some cases, payment of a
fee.The licensed program described in this document and all licensed
materialavailable for it are provided by IBM under terms of the IBM Customer
Agreement,IBM International Program License Agreement, or any equivalent
agreementbetween us.Any performance data contained herein was determined in
a controlledenvironment. Therefore, the results obtained in other operating
environments mayvary significantly. Some measurements may have been made on
development-levelsystems and there is no guarantee that these measurements
will be the same ongenerally available systems. Furthermore, some
measurement may have beenestimated through extrapolation. Actual results may
vary. Users of this documentshould verify the applicable data for their
specific environment.Information concerning non-IBM products was obtained
from the suppliers ofthose products, their published announcements or other
publicly available sources.IBM has not tested those products and cannot
confirm the accuracy ofperformance, compatibility or any other claims
related to non-IBM products.Questions on the capabilities of non-IBM
products should be addressed to thesuppliers of those products.This
information contains examples of data and reports used in daily
businessoperations. To illustrate them as completely as possible, the
examples may includethe names of individuals, companies, brands, and
products. All of these names arefictitious and any similarity to the names
and addresses used by an actual businessenterprise is entirely
coincidental.All statements regarding IBM's future direction or intent are
subject to change orwithdrawal without notice, and represent goals and
objectives only.COPYRIGHT LICENSE:This information contains sample
application programs in source language, whichillustrates programming
techniques on various operating platforms. You may copy,modify, and
distribute these sample programs in any form without payment toIBM, for the
purposes of developing, using, marketing or distributing applicationprograms
conforming to the application programming interface for the
operatingplatform for which the sample programs are written. These examples
have notbeen thoroughly tested under all conditions. IBM, therefore, cannot
guarantee orimply reliability, serviceability, or function of these
programs. You may copy,modify, and distribute these sample programs in any
form without payment toIBM for the purposes of developing, using, marketing,
or distributing applicationprograms conforming to IBM's application
programming interfaces.Programming interface informationProgramming
interface information is intended to help you create applicationsoftware
using this program.General-use programming interfaces allow you to write
application software thatobtain the services of this program's tools.28Web
Services Advanced Topics
----------------------------------------------------------------------------
----
      Page 33
However, this information may also contain diagnosis, modification, and
tuninginformation. Diagnosis, modification and tuning information is
provided to helpyou debug your application software.Warning: Do not use this
diagnosis, modification, and tuning information as aprogramming interface
because it is subject to change.Trademarks and service marksThe following
terms are trademarks of International Business MachinesCorporation in the
United States, other countries, or both:IBMalphaWorksAIXCrossWorldsDB2DB2
OLAP ServerDB2 Universal
DatabaseDeveloperWorksMQSeriesSecureWayWebSphereLotus is a trademark of
International Business Machines Corporation and LotusDevelopment Corporation
in the United States, other countries, or both.Java and all Java-based
trademarks are trademarks of Sun Microsystems, Inc. in theUnited States,
other countries, or both.Microsoft, Windows, Windows NT, and the Windows
logo are trademarks ofMicrosoft Corporation in the United States, other
countries, or both.MMX, Pentium and ProShare are trademarks of Intel
Corporation in the UnitedStates, other countries, or both.Other company,
product or service names may be trademarks or service marks
ofothers.Notices29http://66.102.9.104/search?q=cache:NRTMR42NR2kJ:www-3.ibm.
com/software/integration/busconn/library/doc/v111/web_services/wbc_ws_advanc
edtopics.pdf+RPCrouter+AND+MessageRouter&hl=en

Basically Remote Procedure Call router handles RPC transmissions vs DOM
messages
Very important when dealing with DOM vs SAX Parsers..
-Martin
----- Original Message -----
From: "Daniel Zhang" <zh...@clinicaltools.com>
To: <so...@ws.apache.org>
Sent: Tuesday, May 18, 2004 11:20 AM
Subject: SOAP with Attachment


> In SOAP with attachment examples, the remote URL is
> "http://domainname/soap/servlet/rpcrouter". So the SOAP server may have
> method like getAttachment(DataHandler dh, String param1, String
> param2,...) to get data passed from SOAP client.  I wonder if I can use
> "http://domainname/soap/servlet/messagerouter" as remote URL and pass
> data as attachment to getAttachment(DataHandler dh, String param1,
> String param2,...) sitting at SOAP server?
>
> BTW, what's the difference between rpcrouter and messagerouter? Anyone
> can describe them? TIA.
>
> Daniel
>

SOAP with Attachment

Posted by Daniel Zhang <zh...@clinicaltools.com>.
In SOAP with attachment examples, the remote URL is 
"http://domainname/soap/servlet/rpcrouter". So the SOAP server may have 
method like getAttachment(DataHandler dh, String param1, String 
param2,...) to get data passed from SOAP client.  I wonder if I can use 
"http://domainname/soap/servlet/messagerouter" as remote URL and pass 
data as attachment to getAttachment(DataHandler dh, String param1, 
String param2,...) sitting at SOAP server?

BTW, what's the difference between rpcrouter and messagerouter? Anyone 
can describe them? TIA.

Daniel

Re: requested resource not available

Posted by Scott Nichol <sn...@scottnichol.com>.
How (where) did you install the classes for the example?

Scott Nichol

Do not send e-mail directly to this e-mail address,
because it is filtered to accept only mail from
specific mail lists.
----- Original Message ----- 
From: "Thomas Fischer" <Th...@iao.fraunhofer.de>
To: <so...@ws.apache.org>
Sent: Friday, May 14, 2004 3:56 AM
Subject: Re: requested resource not available



Hi Scott,
deployment works fine, I either use the SOAP GUI
or (preferred) deploy via deployment descriptor:

java org.apache.soap.server.ServiceManagerClient 
http://hal:8088/soap/servlet/rpcrouter deploy PurchaseOrderAcceptorDD.xml


PurchaseOrderAcceptorDD.xml:
=========================================================================
<isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment"
   id="urn:oreilly-jaws-samples" type="message">
   <isd:provider
        type="java"
        scope="Application"
        methods="PurchaseOrder PurchaseOrderWithAttachment">
      <isd:java class="PurchaseOrderAcceptor"/>
   </isd:provider>
<isd:faultListener>org.apache.soap.server.DOMFaultListener</isd:faultListener>
</isd:service>
=========================================================================


Checking the result of deployment via
# java org.apache.soap.server.ServiceManagerClient
       http://hal:8088/soap/servlet/rpcrouter list
results as expected in a :
Deployed Services:
         urn:oreilly-jaws-samples



Any ideas what's wrong? - Thomas


Scott Nichol schrieb:
> What steps have you followed to deploy this sample code?
> 
> Scott Nichol
> 
> Do not send e-mail directly to this e-mail address,
> because it is filtered to accept only mail from
> specific mail lists.
> ----- Original Message ----- 
> From: "Thomas Fischer" <Th...@iao.fraunhofer.de>
> To: <so...@ws.apache.org>
> Sent: Thursday, May 13, 2004 12:56 PM
> Subject: requested resource not available
> 
> 
> 
> Hi,
> I have SOAP 2.3.1 on Tomcat 5.0.19 up and running.
> 
> SOAP examples work fine for me, so the overall setup
> should be fine. But I get an error message when trying
> to run the examples from "oreilly JavaWebServices" Book
> (http://examples.oreilly.com/javawebserv/)
> 
> For me it looks like the Server Side class SimpleHTTPReceive
> is not accessible for Apache SOAP. I placed the class under
> webapps/examples/WEB-INF/classes as requested. Is there
> anything else that I'll have to configure?
> 
> I know, the examples are for tomcat 3.x / 4.x but it should
> be possible to get this stuff up and running in a more
> recent environment.
> 
> Any hints are welcome - Cheers - Tom
> 
> 
> Error Message follows:
> =========================================================================
> 
> Sent SOAP Message with Apache HTTP SOAP Client.
> Waiting for response....
> <html><head><title>Apache Tomcat/5.0.19 - Error 
> report</title><style><!--H1 
> {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} 
> H2 
> {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} 
> H3 
> {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} 
> BODY 
> {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} 
> B 
> {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} 
> P 
> {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A 
> {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> 
> </head><body><h1>HTTP Status 404 - 
> /examples/servlet/SimpleHTTPReceive</h1><HR size="1" 
> noshade><p><b>type</b> Status report</p><p><b>message</b> 
> <u>/examples/servlet/SimpleHTTPReceive</u></p><p><b>description</b> 
> <u>The requested resource (/examples/servlet/SimpleHTTPReceive) is not 
> available.</u></p><HR size="1" noshade><h3>Apache 
> Tomcat/5.0.19</h3></body></html>
> 
> 
> 
> 
> _________________________________________________________________
> 
>    Dr.-Ing. Dipl.-Phys. Thomas Fischer          Fraunhofer IAO
>                                                 Nobelstr. 12
>    phone +49 (0)711 / 970-2037  fax -2299       70569 Stuttgart
>    email Thomas.Fischer@iao.fraunhofer.de       Germany
> _________________________________________________________________
> 
> 

-- 
_________________________________________________________________

   Dr.-Ing. Dipl.-Phys. Thomas Fischer          Fraunhofer IAO
                                                Nobelstr. 12
   phone +49 (0)711 / 970-2037  fax -2299       70569 Stuttgart
   email Thomas.Fischer@iao.fraunhofer.de       Germany
_________________________________________________________________



Re: requested resource not available

Posted by Thomas Fischer <Th...@iao.fraunhofer.de>.
Hi Scott,
deployment works fine, I either use the SOAP GUI
or (preferred) deploy via deployment descriptor:

java org.apache.soap.server.ServiceManagerClient 
http://hal:8088/soap/servlet/rpcrouter deploy PurchaseOrderAcceptorDD.xml


PurchaseOrderAcceptorDD.xml:
=========================================================================
<isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment"
   id="urn:oreilly-jaws-samples" type="message">
   <isd:provider
        type="java"
        scope="Application"
        methods="PurchaseOrder PurchaseOrderWithAttachment">
      <isd:java class="PurchaseOrderAcceptor"/>
   </isd:provider>
<isd:faultListener>org.apache.soap.server.DOMFaultListener</isd:faultListener>
</isd:service>
=========================================================================


Checking the result of deployment via
# java org.apache.soap.server.ServiceManagerClient
       http://hal:8088/soap/servlet/rpcrouter list
results as expected in a :
Deployed Services:
         urn:oreilly-jaws-samples



Any ideas what's wrong? - Thomas


Scott Nichol schrieb:
> What steps have you followed to deploy this sample code?
> 
> Scott Nichol
> 
> Do not send e-mail directly to this e-mail address,
> because it is filtered to accept only mail from
> specific mail lists.
> ----- Original Message ----- 
> From: "Thomas Fischer" <Th...@iao.fraunhofer.de>
> To: <so...@ws.apache.org>
> Sent: Thursday, May 13, 2004 12:56 PM
> Subject: requested resource not available
> 
> 
> 
> Hi,
> I have SOAP 2.3.1 on Tomcat 5.0.19 up and running.
> 
> SOAP examples work fine for me, so the overall setup
> should be fine. But I get an error message when trying
> to run the examples from "oreilly JavaWebServices" Book
> (http://examples.oreilly.com/javawebserv/)
> 
> For me it looks like the Server Side class SimpleHTTPReceive
> is not accessible for Apache SOAP. I placed the class under
> webapps/examples/WEB-INF/classes as requested. Is there
> anything else that I'll have to configure?
> 
> I know, the examples are for tomcat 3.x / 4.x but it should
> be possible to get this stuff up and running in a more
> recent environment.
> 
> Any hints are welcome - Cheers - Tom
> 
> 
> Error Message follows:
> =========================================================================
> 
> Sent SOAP Message with Apache HTTP SOAP Client.
> Waiting for response....
> <html><head><title>Apache Tomcat/5.0.19 - Error 
> report</title><style><!--H1 
> {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} 
> H2 
> {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} 
> H3 
> {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} 
> BODY 
> {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} 
> B 
> {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} 
> P 
> {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A 
> {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> 
> </head><body><h1>HTTP Status 404 - 
> /examples/servlet/SimpleHTTPReceive</h1><HR size="1" 
> noshade><p><b>type</b> Status report</p><p><b>message</b> 
> <u>/examples/servlet/SimpleHTTPReceive</u></p><p><b>description</b> 
> <u>The requested resource (/examples/servlet/SimpleHTTPReceive) is not 
> available.</u></p><HR size="1" noshade><h3>Apache 
> Tomcat/5.0.19</h3></body></html>
> 
> 
> 
> 
> _________________________________________________________________
> 
>    Dr.-Ing. Dipl.-Phys. Thomas Fischer          Fraunhofer IAO
>                                                 Nobelstr. 12
>    phone +49 (0)711 / 970-2037  fax -2299       70569 Stuttgart
>    email Thomas.Fischer@iao.fraunhofer.de       Germany
> _________________________________________________________________
> 
> 

-- 
_________________________________________________________________

   Dr.-Ing. Dipl.-Phys. Thomas Fischer          Fraunhofer IAO
                                                Nobelstr. 12
   phone +49 (0)711 / 970-2037  fax -2299       70569 Stuttgart
   email Thomas.Fischer@iao.fraunhofer.de       Germany
_________________________________________________________________


Re: requested resource not available

Posted by Scott Nichol <sn...@scottnichol.com>.
What steps have you followed to deploy this sample code?

Scott Nichol

Do not send e-mail directly to this e-mail address,
because it is filtered to accept only mail from
specific mail lists.
----- Original Message ----- 
From: "Thomas Fischer" <Th...@iao.fraunhofer.de>
To: <so...@ws.apache.org>
Sent: Thursday, May 13, 2004 12:56 PM
Subject: requested resource not available



Hi,
I have SOAP 2.3.1 on Tomcat 5.0.19 up and running.

SOAP examples work fine for me, so the overall setup
should be fine. But I get an error message when trying
to run the examples from "oreilly JavaWebServices" Book
(http://examples.oreilly.com/javawebserv/)

For me it looks like the Server Side class SimpleHTTPReceive
is not accessible for Apache SOAP. I placed the class under
webapps/examples/WEB-INF/classes as requested. Is there
anything else that I'll have to configure?

I know, the examples are for tomcat 3.x / 4.x but it should
be possible to get this stuff up and running in a more
recent environment.

Any hints are welcome - Cheers - Tom


Error Message follows:
=========================================================================

Sent SOAP Message with Apache HTTP SOAP Client.
Waiting for response....
<html><head><title>Apache Tomcat/5.0.19 - Error 
report</title><style><!--H1 
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} 
H2 
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} 
H3 
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} 
BODY 
{font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} 
B 
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} 
P 
{font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A 
{color : black;}A.name {color : black;}HR {color : #525D76;}--></style> 
</head><body><h1>HTTP Status 404 - 
/examples/servlet/SimpleHTTPReceive</h1><HR size="1" 
noshade><p><b>type</b> Status report</p><p><b>message</b> 
<u>/examples/servlet/SimpleHTTPReceive</u></p><p><b>description</b> 
<u>The requested resource (/examples/servlet/SimpleHTTPReceive) is not 
available.</u></p><HR size="1" noshade><h3>Apache 
Tomcat/5.0.19</h3></body></html>




_________________________________________________________________

   Dr.-Ing. Dipl.-Phys. Thomas Fischer          Fraunhofer IAO
                                                Nobelstr. 12
   phone +49 (0)711 / 970-2037  fax -2299       70569 Stuttgart
   email Thomas.Fischer@iao.fraunhofer.de       Germany
_________________________________________________________________