You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Alex Chen <al...@sbcglobal.net> on 2003/10/08 09:10:50 UTC

Stub class

I am using the code in samples/jaxrpc/hello as a template to build my
service.
In HelloClient, it uses the following code to get a service stub:

        String UrlString =
"http://localhost:8080/axis/services/HelloPort?wsdl";
        String nameSpaceUri = "http://hello.jaxrpc.samples/";
        String serviceName = "HelloWorld";
        String portName = "HelloPort";

        URL helloWsdlUrl = new URL(UrlString);
        ServiceFactory serviceFactory = ServiceFactory.newInstance();
        Service helloService = serviceFactory.createService(helloWsdlUrl,
                new QName(nameSpaceUri, serviceName));

        java.util.List list =
helloService.getHandlerRegistry().getHandlerChain(new QName(nameSpaceUri,
portName));
        list.add(new
javax.xml.rpc.handler.HandlerInfo(ClientHandler.class,null,null));

        Hello myProxy = (Hello) helloService.getPort(
                new QName(nameSpaceUri, portName),
                samples.jaxrpc.hello.Hello.class);  
 
According to the user guide, the client can get a service stub from the
locator,
under the section 'Services'.  When I followed the instruction and modified
the code to
make the following calls instead of the above snippet,

        HelloWorld service = new HelloWorldLocator();
        Hello myProxy      = service.getHelloPort();

When the call myProxy.sayHello(msg) is made, the first method, using
ServiceFactory, works fine.
But the second method, using the HelloWorldLocator, fails with the following
SOAP fault.
What is the problem?


Exception in thread "main" AxisFault
 faultCode: {http://xml.apache.org/axis/}HTTP
 faultSubcode:
 faultString: (404)/axis/Hello
 faultActor:
 faultNode:
 faultDetail:
        {}string: return code:  404
&lt;html&gt;&lt;head&gt;&lt;title&gt;Apache Tomcat/5.0.9 - Error
report&lt;/title&gt&lt;style&gt;&lt;!--H1
{fontfamily:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;fon
t-size:22px;} H2
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;fo
nt-size:16px;} H3
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;fo
nt-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;}HR {color : #525D76;}--&gt;&lt;/style&gt;
&lt;/head&gt;&lt;body&gt;&lt;h1&gt;HTTP Status 404 -
/axis/Hello&lt;/h1&gt;&lt;HR size=&quot;1&quot;
noshade&gt;&lt;p&gt;&lt;b&gt;type&lt;/b&gt; Status
report&lt;/p&gt;&lt;p&gt;&lt;b&gt;message&lt;/b&gt;
&lt;u&gt;/axis/Hello&lt;/u&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;description&lt;/b&
gt; &lt;u&gt;The requested resource (/axis/Hello) is not
available.&lt;/u&gt;&lt;/p&gt;&lt;HR size=&quot;1&quot;
noshade&gt;&lt;h3&gt;Apache
Tomcat/5.0.9&lt;/h3&gt;&lt;/body&gt;&lt;/html&gt;

(404)/axis/Hello
        at
org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.j
ava:630)
        at
org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:128)

        at
org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrateg
y.java:71)
        at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:150)
        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:120)
        at org.apache.axis.client.AxisClient.invoke(AxisClient.java:180)
        at org.apache.axis.client.Call.invokeEngine(Call.java:2564)
        at org.apache.axis.client.Call.invoke(Call.java:2553)
        at org.apache.axis.client.Call.invoke(Call.java:2248)
        at org.apache.axis.client.Call.invoke(Call.java:2171)
        at org.apache.axis.client.Call.invoke(Call.java:1691)
....


RE: Stub class

Posted by Alex Chen <al...@sbcglobal.net>.
Will there be a bug open against this problem?

> -----Original Message-----
> From: Gary L Peskin [mailto:garyp@firstech.com]
> Sent: Wednesday, October 08, 2003 9:17 AM
> To: axis-user@ws.apache.org
> Subject: RE: Stub class
> 
> 
> It looks to me like the default URL built into the 
> HelloWorldLocator comes
> from the WSDL which is http://localhost:8080/axis/Hello.  This is not
> correct.  It should match your UrlString.  It looks like the WSDL file
> soap:address element is just wrong.
> 
> As a workaround, you could code 
> service.getHelloPort(UrlString) which should
> solve this problem.  If that works, you could change 
> HelloWorld.wsdl match
> your URL and then run WSDL2Java to regenerate a new 
> HelloWorldLocator that
> you could deploy into Tomcat.
> 
> HTH,
> Gary
> 
> 
> > -----Original Message-----
> > From: Alex Chen [mailto:alex_chen@sbcglobal.net] 
> > Sent: Wednesday, October 08, 2003 12:11 AM
> > To: axis-user@ws.apache.org
> > Subject: Stub class
> > 
> > 
> > I am using the code in samples/jaxrpc/hello as a template to 
> > build my service. In HelloClient, it uses the following code 
> > to get a service stub:
> > 
> >         String UrlString = 
> > "http://localhost:8080/axis/services/HelloPort?wsdl";
> >         String nameSpaceUri = "http://hello.jaxrpc.samples/";
> >         String serviceName = "HelloWorld";
> >         String portName = "HelloPort";
> > 
> >         URL helloWsdlUrl = new URL(UrlString);
> >         ServiceFactory serviceFactory = 
> ServiceFactory.newInstance();
> >         Service helloService = 
> > serviceFactory.createService(helloWsdlUrl,
> >                 new QName(nameSpaceUri, serviceName));
> > 
> >         java.util.List list = 
> > helloService.getHandlerRegistry().getHandlerChain(new 
> > QName(nameSpaceUri, portName));
> >         list.add(new 
> > javax.xml.rpc.handler.HandlerInfo(ClientHandler.class,null,null));
> > 
> >         Hello myProxy = (Hello) helloService.getPort(
> >                 new QName(nameSpaceUri, portName),
> >                 samples.jaxrpc.hello.Hello.class);  
> >  
> > According to the user guide, the client can get a service 
> > stub from the locator, under the section 'Services'.  When I 
> > followed the instruction and modified the code to make the 
> > following calls instead of the above snippet,
> > 
> >         HelloWorld service = new HelloWorldLocator();
> >         Hello myProxy      = service.getHelloPort();
> > 
> > When the call myProxy.sayHello(msg) is made, the first 
> > method, using ServiceFactory, works fine. But the second 
> > method, using the HelloWorldLocator, fails with the following 
> > SOAP fault. What is the problem?
> > 
> > 
> > Exception in thread "main" AxisFault
> >  faultCode: {http://xml.apache.org/axis/}HTTP
> >  faultSubcode:
> >  faultString: (404)/axis/Hello
> >  faultActor:
> >  faultNode:
> >  faultDetail:
> >         {}string: return code:  404 
> > &lt;html&gt;&lt;head&gt;&lt;title&gt;Apache Tomcat/5.0.9 - 
> > Error report&lt;/title&gt&lt;style&gt;&lt;!--H1 
> > {fontfamily:Tahoma,Arial,sans-serif;color:white;background-col
> > or:#525D76;font-size:22px;} H2 
> > {font-family:Tahoma,Arial,sans-serif;color:white;background-co
> > lor:#525D76;font-size:16px;} H3 
> > {font-family:Tahoma,Arial,sans-serif;color:white;background-co
> > lor:#525D76;font-size:14px;} BODY 
> > {font-family:Tahoma,Arial,sans-serif;color:black;background-co
> > lor:white;} B 
> > {font-family:Tahoma,Arial,sans-serif;color:white;background-co
> > lor:525D76;} P 
> > {font-family:Tahoma,Arial,sans-serif;background:white;color:bl
> > ack;font-size:12px;}A {color : black;}HR {color : 
> > #525D76;}--&gt;&lt;/style&gt; 
> > &lt;/head&gt;&lt;body&gt;&lt;h1&gt;HTTP Status 404 - 
> > /axis/Hello&lt;/h1&gt;&lt;HR size=&quot;1&quot; 
> > noshade&gt;&lt;p&gt;&lt;b&gt;type&lt;/b&gt; Status 
> > report&lt;/p&gt;&lt;p&gt;&lt;b&gt;message&lt;/b&gt; 
> > &lt;u&gt;/axis/Hello&lt;/u&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;desc
> > ription&lt;/b&gt; &lt;u&gt;The requested resource 
> > (/axis/Hello) is not available.&lt;/u&gt;&lt;/p&gt;&lt;HR 
> > size=&quot;1&quot; noshade&gt;&lt;h3&gt;Apache 
> > Tomcat/5.0.9&lt;/h3&gt;&lt;/body&gt;&lt;/html&gt;
> > 
> > (404)/axis/Hello
> >         at 
> > 
> org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.j
> > ava:630)
> >         at 
> > 
> org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:128)
> > 
> >         at 
> > 
> org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrateg
> > y.java:71)
> >         at 
> > org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:150)
> >         at org.apache.axis.SimpleChain.invoke(SimpleChain.java:120)
> >         at 
> > org.apache.axis.client.AxisClient.invoke(AxisClient.java:180)
> >         at org.apache.axis.client.Call.invokeEngine(Call.java:2564)
> >         at org.apache.axis.client.Call.invoke(Call.java:2553)
> >         at org.apache.axis.client.Call.invoke(Call.java:2248)
> >         at org.apache.axis.client.Call.invoke(Call.java:2171)
> >         at org.apache.axis.client.Call.invoke(Call.java:1691)
> > ....
> > 
> > 

RE: Stub class

Posted by Gary L Peskin <ga...@firstech.com>.
It looks to me like the default URL built into the HelloWorldLocator comes
from the WSDL which is http://localhost:8080/axis/Hello.  This is not
correct.  It should match your UrlString.  It looks like the WSDL file
soap:address element is just wrong.

As a workaround, you could code service.getHelloPort(UrlString) which should
solve this problem.  If that works, you could change HelloWorld.wsdl match
your URL and then run WSDL2Java to regenerate a new HelloWorldLocator that
you could deploy into Tomcat.

HTH,
Gary


> -----Original Message-----
> From: Alex Chen [mailto:alex_chen@sbcglobal.net] 
> Sent: Wednesday, October 08, 2003 12:11 AM
> To: axis-user@ws.apache.org
> Subject: Stub class
> 
> 
> I am using the code in samples/jaxrpc/hello as a template to 
> build my service. In HelloClient, it uses the following code 
> to get a service stub:
> 
>         String UrlString = 
> "http://localhost:8080/axis/services/HelloPort?wsdl";
>         String nameSpaceUri = "http://hello.jaxrpc.samples/";
>         String serviceName = "HelloWorld";
>         String portName = "HelloPort";
> 
>         URL helloWsdlUrl = new URL(UrlString);
>         ServiceFactory serviceFactory = ServiceFactory.newInstance();
>         Service helloService = 
> serviceFactory.createService(helloWsdlUrl,
>                 new QName(nameSpaceUri, serviceName));
> 
>         java.util.List list = 
> helloService.getHandlerRegistry().getHandlerChain(new 
> QName(nameSpaceUri, portName));
>         list.add(new 
> javax.xml.rpc.handler.HandlerInfo(ClientHandler.class,null,null));
> 
>         Hello myProxy = (Hello) helloService.getPort(
>                 new QName(nameSpaceUri, portName),
>                 samples.jaxrpc.hello.Hello.class);  
>  
> According to the user guide, the client can get a service 
> stub from the locator, under the section 'Services'.  When I 
> followed the instruction and modified the code to make the 
> following calls instead of the above snippet,
> 
>         HelloWorld service = new HelloWorldLocator();
>         Hello myProxy      = service.getHelloPort();
> 
> When the call myProxy.sayHello(msg) is made, the first 
> method, using ServiceFactory, works fine. But the second 
> method, using the HelloWorldLocator, fails with the following 
> SOAP fault. What is the problem?
> 
> 
> Exception in thread "main" AxisFault
>  faultCode: {http://xml.apache.org/axis/}HTTP
>  faultSubcode:
>  faultString: (404)/axis/Hello
>  faultActor:
>  faultNode:
>  faultDetail:
>         {}string: return code:  404 
> &lt;html&gt;&lt;head&gt;&lt;title&gt;Apache Tomcat/5.0.9 - 
> Error report&lt;/title&gt&lt;style&gt;&lt;!--H1 
> {fontfamily:Tahoma,Arial,sans-serif;color:white;background-col
> or:#525D76;font-size:22px;} H2 
> {font-family:Tahoma,Arial,sans-serif;color:white;background-co
> lor:#525D76;font-size:16px;} H3 
> {font-family:Tahoma,Arial,sans-serif;color:white;background-co
> lor:#525D76;font-size:14px;} BODY 
> {font-family:Tahoma,Arial,sans-serif;color:black;background-co
> lor:white;} B 
> {font-family:Tahoma,Arial,sans-serif;color:white;background-co
> lor:525D76;} P 
> {font-family:Tahoma,Arial,sans-serif;background:white;color:bl
> ack;font-size:12px;}A {color : black;}HR {color : 
> #525D76;}--&gt;&lt;/style&gt; 
> &lt;/head&gt;&lt;body&gt;&lt;h1&gt;HTTP Status 404 - 
> /axis/Hello&lt;/h1&gt;&lt;HR size=&quot;1&quot; 
> noshade&gt;&lt;p&gt;&lt;b&gt;type&lt;/b&gt; Status 
> report&lt;/p&gt;&lt;p&gt;&lt;b&gt;message&lt;/b&gt; 
> &lt;u&gt;/axis/Hello&lt;/u&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;desc
> ription&lt;/b&gt; &lt;u&gt;The requested resource 
> (/axis/Hello) is not available.&lt;/u&gt;&lt;/p&gt;&lt;HR 
> size=&quot;1&quot; noshade&gt;&lt;h3&gt;Apache 
> Tomcat/5.0.9&lt;/h3&gt;&lt;/body&gt;&lt;/html&gt;
> 
> (404)/axis/Hello
>         at 
> org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.j
> ava:630)
>         at 
> org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:128)
> 
>         at 
> org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrateg
> y.java:71)
>         at 
> org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:150)
>         at org.apache.axis.SimpleChain.invoke(SimpleChain.java:120)
>         at 
> org.apache.axis.client.AxisClient.invoke(AxisClient.java:180)
>         at org.apache.axis.client.Call.invokeEngine(Call.java:2564)
>         at org.apache.axis.client.Call.invoke(Call.java:2553)
>         at org.apache.axis.client.Call.invoke(Call.java:2248)
>         at org.apache.axis.client.Call.invoke(Call.java:2171)
>         at org.apache.axis.client.Call.invoke(Call.java:1691)
> ....
> 
>