You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Phani Madgula <ph...@gmail.com> on 2006/02/06 05:50:37 UTC

WEBSERVICES problem

Hi

I have deployed a WEBSERVICE implemented using an EJB, and facing a problem
while accessing through Dynamic Proxy client.
The client is as follows.


        String urlstr   =  "http://localhost:8080/TestEJB/Hello?wsdl";

         String argument =  "phani";

        System.out.println("Contacting webservice at " + urlstr);

        URL url =  new URL(urlstr);

        QName qname = new QName("http://hello.phani.org/", "HelloService");

        ServiceFactory factory = ServiceFactory.newInstance();
        Service        service = factory.createService(url, qname);

        Hello          hello   = (Hello) service.getPort(Hello.class);

        System.out.println("hello.hello(" + argument + ")");
        System.out.println("output:" + hello.hello(argument));



The error is

Contacting webservice at http://localhost:8080/TestEJB/Hello?wsdl
Exception in thread "main" javax.xml.rpc.ServiceException: Error processing
WSDL document:
java.io.IOException: Server returned HTTP response code: 500 for URL:
http://localhost:8080/TestEJB/Hello/?wsdl
        at org.apache.axis.client.Service.initService(Service.java:250)
        at org.apache.axis.client.Service.<init>(Service.java:165)
        at org.apache.axis.client.ServiceFactory.createService(
ServiceFactory.java:198)
        at HelloClient.main(HelloClient.java:27)

If we can observe the error trace, a '/' is getting appended for the URL "
http://localhost:8080/TestEJB/Hello" and making it "
http://localhost:8080/TestEJB/Hello/?wsdl". It is not happening for
WEBSERVICE implemented using a servlet.



The WSDL is as follows.

<?xml version="1.0" encoding="UTF-8"?>

<definitions name="HelloService" targetNamespace="http://hello.phani.org/"
xmlns:tns="http://hello.phani.org/" xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="
http://schemas.xmlsoap.org/wsdl/soap/">
  <types/>
  <message name="Hello_hello">
    <part name="String_1" type="xsd:string"/></message>
  <message name="Hello_helloResponse">
    <part name="result" type="xsd:string"/></message>
  <portType name="Hello">
    <operation name="hello" parameterOrder="String_1">
      <input message="tns:Hello_hello"/>
      <output message="tns:Hello_helloResponse"/></operation></portType>
  <binding name="HelloBinding" type="tns:Hello">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="rpc"/>
    <operation name="hello">
      <soap:operation soapAction=""/>
      <input>
        <soap:body use="literal" namespace="
http://hello.phani.org/"/></input>
      <output>
        <soap:body use="literal" namespace="
http://hello.phani.org/"/></output></operation></binding>
  <service name="HelloService">
    <port name="HelloPort" binding="tns:HelloBinding">
      <soap:address location="
http://localhost:8080/TestEJB/Hello"/></port></service></definitions>

Why is an extra '/' is getting added ?

Any issues?

Thanks

phani

Re: WEBSERVICES problem

Posted by Aaron Mulder <am...@alumni.princeton.edu>.
OK, can you file a bug for this?  I'm not too familiar with the Axis
code myself, but it seems clear that extra slashes are getting
inserted here and there.

http://issues.apache.org/jira/secure/BrowseProject.jspa?id=10220

Thanks,
    Aaron

On 2/6/06, Phani Madgula <ph...@gmail.com> wrote:
> Hi Aaron,
> Thanks for reply.
>
> I have added the following tags in openejb-jar.xml to bind the service to a
> different URL than what is specified in wsdl file.
>
>  <enterprise-beans>
>     <session>
>         <ejb-name>HelloBean</ejb-name>
>         <jndi-name>HelloBean</jndi-name>
>
> <web-service-address>/RAMESH/Hello</web-service-address>
>     </session>
>  </enterprise-beans>
>
> where as my wsdl file contains
>   <port name="HelloPort" binding="tns:HelloBinding">
>       <soap:address
> location="http://localhost:8080/TestEJB/Hello"/></port >
>
>
> In either case, the extra '/' is being generated while using Dynamic Proxy
> client.
>
> Contacting webservice at
> http://localhost:8080/RAMESH/Hello?wsdl
> Exception in thread "main" javax.xml.rpc.ServiceException: Error processing
> WSDL document:
> java.io.IOException: Server returned HTTP response code: 500 for URL:
> http://localhost:8080/RAMESH/Hello/?wsdl
>         at org.apache.axis.client.Service.initService
> (Service.java:250)
>         at org.apache.axis.client.Service.<init>(Service.java:165)
>         at
> org.apache.axis.client.ServiceFactory.createService(ServiceFactory.java:198)
>         at HelloClient.main(HelloClient.java :27)
>
> Even while viewing wsdl from a browser window, at the URL
> 'http://localhost:8080/TestEJB/Hello?wsdl", the extra '/'
> is getting appended.
>
> Thanks
> phani
>
>
>
>
> On 2/6/06, Aaron Mulder <am...@alumni.princeton.edu> wrote:
> > I was able to get a web services reference (service-ref) from a web
> > app to connect to an EJB exposed as a web service in Geronimo 1.0 when
> > working through some tests for my web services chapter at:
> >
> > http://chariotsolutions.com/geronimo/web-services.html
> >
> > However, I did not try a dynamic proxy client.
> >
> > I did notice that a servlet web service got an extra slash in the URL
> > it generated in the WSDL, though in my case it was after the port not
> > at the end of the name.  Perhaps this is related?
> >
> > If you look at the WSDL file at the URL
> > http://localhost:8080/TestEJB/Hello?wsdl (NOTE: not your
> original copy
> > of the WSDL, but specifically look at the copy at that URL), does the
> > service URL have the extra slash in it?  If so, that's likely the
> > problem, and possibly related to the slash problem I had, which I
> > recorded at:
> >
> > http://issues.apache.org/jira/browse/GERONIMO-1584
> >
> > In any case, to work around this, you might try adding a
> > web-service-address element to your EJB configuration in
> > openejb-jar.xml and see if you can provide an explicit value there
> > that might override the auto-generated one with the extra slash.
> > (Also, of course, make sure you don't have a web-service-address there
> > already that has a slash on the end.)
> >
> > Thanks,
> >    Aaron
> >
> > On 2/5/06, Phani Madgula <ph...@gmail.com> wrote:
> > > Hi
> > >
> > > I have deployed a WEBSERVICE implemented using an EJB, and facing a
> problem
> > > while accessing through Dynamic Proxy client.
> > > The client is as follows.
> > >
> > >
> > >
> > >         String urlstr   =
> > > "http://localhost:8080/TestEJB/Hello?wsdl ";
> > >
> > >          String argument =  "phani";
> > >
> > >         System.out.println("Contacting webservice at " + urlstr);
> > >
> > >         URL url =  new URL(urlstr);
> > >
> > >         QName qname = new QName("http://hello.phani.org/",
> "HelloService");
> > >
> > >         ServiceFactory factory = ServiceFactory.newInstance ();
> > >         Service        service = factory.createService(url, qname);
> > >
> > >         Hello          hello   = (Hello) service.getPort(Hello.class);
> > >
> > >         System.out.println("hello.hello (" + argument + ")");
> > >         System.out.println("output:" + hello.hello(argument));
> > >
> > >
> > >
> > > The error is
> > >
> > > Contacting webservice at
> > > http://localhost:8080/TestEJB/Hello?wsdl
> > > Exception in thread "main" javax.xml.rpc.ServiceException: Error
> processing
> > > WSDL document:
> > > java.io.IOException: Server returned HTTP response code: 500 for URL:
> > > http://localhost:8080/TestEJB/Hello/?wsdl
> > >         at org.apache.axis.client.Service.initService
> > > (Service.java:250)
> > >         at org.apache.axis.client.Service .<init>(Service.java:165)
> > >         at
> > >
> org.apache.axis.client.ServiceFactory.createService(ServiceFactory.java:198)
> > >         at HelloClient.main(HelloClient.java :27)
> > >
> > > If we can observe the error trace, a '/' is getting appended for the URL
> > > "http://localhost:8080/TestEJB/Hello" and making it "
> > > http://localhost:8080/TestEJB/Hello/?wsdl ". It is not
> > > happening for WEBSERVICE implemented using a servlet.
> > >
> > >
> > >
> > > The WSDL is as follows.
> > >
> > > <?xml version="1.0" encoding="UTF-8"?>
> > >
> > > <definitions name="HelloService"
> targetNamespace="http://hello.phani.org/"
> > > xmlns:tns="http://hello.phani.org/ " xmlns="
> > > http://schemas.xmlsoap.org/wsdl/"
> > > xmlns:xsd="http://www.w3.org/2001/XMLSchema "
> xmlns:soap="
> > > http://schemas.xmlsoap.org/wsdl/soap/">
> > >   <types/>
> > >   <message name="Hello_hello">
> > >     <part name="String_1" type="xsd:string"/></message>
> > >   <message name="Hello_helloResponse">
> > >     <part name="result" type="xsd:string"/></message>
> > >   <portType name="Hello">
> > >     <operation name="hello" parameterOrder="String_1">
> > >        <input message="tns:Hello_hello"/>
> > >       <output
> > >
> message="tns:Hello_helloResponse"/></operation></portType>
> > >   <binding name="HelloBinding" type="tns:Hello">
> > >     <soap:binding
> > > transport="http://schemas.xmlsoap.org/soap/http"
> > > style="rpc"/>
> > >     <operation name="hello">
> > >       <soap:operation soapAction=""/>
> > >       <input>
> > >         <soap:body use="literal"
> > > namespace="http://hello.phani.org/ "/></input>
> > >       <output>
> > >          <soap:body use="literal"
> > >
> namespace="http://hello.phani.org/"/></output></operation></binding
> > > >
> > >   <service name="HelloService">
> > >     <port name="HelloPort" binding="tns:HelloBinding">
> > >       <soap:address location="
> > >
> http://localhost:8080/TestEJB/Hello"/></port></service></definitions>
> > >
> > >
> > > Why is an extra '/' is getting added ?
> > >
> > > Any issues?
> > >
> > > Thanks
> > >
> > > phani
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
>
>

Re: WEBSERVICES problem

Posted by Phani Madgula <ph...@gmail.com>.
Hi Aaron,
Thanks for reply.

I have added the following tags in openejb-jar.xml to bind the service to a
different URL than what is specified in wsdl file.

 <enterprise-beans>
    <session>
        <ejb-name>HelloBean</ejb-name>
        <jndi-name>HelloBean</jndi-name>
        <web-service-address>/RAMESH/Hello</web-service-address>
    </session>
 </enterprise-beans>

where as my wsdl file contains
  <port name="HelloPort" binding="tns:HelloBinding">
      <soap:address location="http://localhost:8080/TestEJB/Hello"/></port>


In either case, the extra '/' is being generated while using Dynamic Proxy
client.

Contacting webservice at http://localhost:8080/RAMESH/Hello?wsdl
Exception in thread "main" javax.xml.rpc.ServiceException: Error processing
WSDL document:
java.io.IOException: Server returned HTTP response code: 500 for URL:
http://localhost:8080/RAMESH/Hello/?wsdl
        at org.apache.axis.client.Service.initService(Service.java:250)
        at org.apache.axis.client.Service.<init>(Service.java:165)
        at org.apache.axis.client.ServiceFactory.createService(
ServiceFactory.java:198)
        at HelloClient.main(HelloClient.java:27)

Even while viewing wsdl from a browser window, at the URL '
http://localhost:8080/TestEJB/Hello<http://localhost:8080/TestEJB/Hello"/></port>?wsdl",
the extra '/' is getting appended.

Thanks
phani



On 2/6/06, Aaron Mulder <am...@alumni.princeton.edu> wrote:
>
> I was able to get a web services reference (service-ref) from a web
> app to connect to an EJB exposed as a web service in Geronimo 1.0 when
> working through some tests for my web services chapter at:
>
> http://chariotsolutions.com/geronimo/web-services.html
>
> However, I did not try a dynamic proxy client.
>
> I did notice that a servlet web service got an extra slash in the URL
> it generated in the WSDL, though in my case it was after the port not
> at the end of the name.  Perhaps this is related?
>
> If you look at the WSDL file at the URL
> http://localhost:8080/TestEJB/Hello?wsdl (NOTE: not your original copy
> of the WSDL, but specifically look at the copy at that URL), does the
> service URL have the extra slash in it?  If so, that's likely the
> problem, and possibly related to the slash problem I had, which I
> recorded at:
>
> http://issues.apache.org/jira/browse/GERONIMO-1584
>
> In any case, to work around this, you might try adding a
> web-service-address element to your EJB configuration in
> openejb-jar.xml and see if you can provide an explicit value there
> that might override the auto-generated one with the extra slash.
> (Also, of course, make sure you don't have a web-service-address there
> already that has a slash on the end.)
>
> Thanks,
>    Aaron
>
> On 2/5/06, Phani Madgula <ph...@gmail.com> wrote:
> > Hi
> >
> > I have deployed a WEBSERVICE implemented using an EJB, and facing a
> problem
> > while accessing through Dynamic Proxy client.
> > The client is as follows.
> >
> >
> >
> >         String urlstr   =
> > "http://localhost:8080/TestEJB/Hello?wsdl";
> >
> >          String argument =  "phani";
> >
> >         System.out.println("Contacting webservice at " + urlstr);
> >
> >         URL url =  new URL(urlstr);
> >
> >         QName qname = new QName("http://hello.phani.org/",
> "HelloService");
> >
> >         ServiceFactory factory = ServiceFactory.newInstance();
> >         Service        service = factory.createService(url, qname);
> >
> >         Hello          hello   = (Hello) service.getPort(Hello.class);
> >
> >         System.out.println("hello.hello(" + argument + ")");
> >         System.out.println("output:" + hello.hello(argument));
> >
> >
> >
> > The error is
> >
> > Contacting webservice at
> > http://localhost:8080/TestEJB/Hello?wsdl
> > Exception in thread "main" javax.xml.rpc.ServiceException: Error
> processing
> > WSDL document:
> > java.io.IOException: Server returned HTTP response code: 500 for URL:
> > http://localhost:8080/TestEJB/Hello/?wsdl
> >         at org.apache.axis.client.Service.initService
> > (Service.java:250)
> >         at org.apache.axis.client.Service.<init>(Service.java:165)
> >         at
> > org.apache.axis.client.ServiceFactory.createService(ServiceFactory.java
> :198)
> >         at HelloClient.main(HelloClient.java :27)
> >
> > If we can observe the error trace, a '/' is getting appended for the URL
> > "http://localhost:8080/TestEJB/Hello" and making it "
> > http://localhost:8080/TestEJB/Hello/?wsdl". It is not
> > happening for WEBSERVICE implemented using a servlet.
> >
> >
> >
> > The WSDL is as follows.
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> >
> > <definitions name="HelloService" targetNamespace="
> http://hello.phani.org/"
> > xmlns:tns="http://hello.phani.org/" xmlns="
> > http://schemas.xmlsoap.org/wsdl/"
> > xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="
> > http://schemas.xmlsoap.org/wsdl/soap/">
> >   <types/>
> >   <message name="Hello_hello">
> >     <part name="String_1" type="xsd:string"/></message>
> >   <message name="Hello_helloResponse">
> >     <part name="result" type="xsd:string"/></message>
> >   <portType name="Hello">
> >     <operation name="hello" parameterOrder="String_1">
> >        <input message="tns:Hello_hello"/>
> >       <output
> > message="tns:Hello_helloResponse"/></operation></portType>
> >   <binding name="HelloBinding" type="tns:Hello">
> >     <soap:binding
> > transport="http://schemas.xmlsoap.org/soap/http"
> > style="rpc"/>
> >     <operation name="hello">
> >       <soap:operation soapAction=""/>
> >       <input>
> >         <soap:body use="literal"
> > namespace="http://hello.phani.org/"/></input>
> >       <output>
> >          <soap:body use="literal"
> > namespace="http://hello.phani.org/"/></output></operation></binding
> > >
> >   <service name="HelloService">
> >     <port name="HelloPort" binding="tns:HelloBinding">
> >       <soap:address location="
> > http://localhost:8080/TestEJB/Hello"/></port></service></definitions>
> >
> >
> > Why is an extra '/' is getting added ?
> >
> > Any issues?
> >
> > Thanks
> >
> > phani
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
>

Re: WEBSERVICES problem

Posted by Aaron Mulder <am...@alumni.princeton.edu>.
I was able to get a web services reference (service-ref) from a web
app to connect to an EJB exposed as a web service in Geronimo 1.0 when
working through some tests for my web services chapter at:

http://chariotsolutions.com/geronimo/web-services.html

However, I did not try a dynamic proxy client.

I did notice that a servlet web service got an extra slash in the URL
it generated in the WSDL, though in my case it was after the port not
at the end of the name.  Perhaps this is related?

If you look at the WSDL file at the URL
http://localhost:8080/TestEJB/Hello?wsdl (NOTE: not your original copy
of the WSDL, but specifically look at the copy at that URL), does the
service URL have the extra slash in it?  If so, that's likely the
problem, and possibly related to the slash problem I had, which I
recorded at:

http://issues.apache.org/jira/browse/GERONIMO-1584

In any case, to work around this, you might try adding a
web-service-address element to your EJB configuration in
openejb-jar.xml and see if you can provide an explicit value there
that might override the auto-generated one with the extra slash. 
(Also, of course, make sure you don't have a web-service-address there
already that has a slash on the end.)

Thanks,
    Aaron

On 2/5/06, Phani Madgula <ph...@gmail.com> wrote:
> Hi
>
> I have deployed a WEBSERVICE implemented using an EJB, and facing a problem
> while accessing through Dynamic Proxy client.
> The client is as follows.
>
>
>
>         String urlstr   =
> "http://localhost:8080/TestEJB/Hello?wsdl";
>
>          String argument =  "phani";
>
>         System.out.println("Contacting webservice at " + urlstr);
>
>         URL url =  new URL(urlstr);
>
>         QName qname = new QName("http://hello.phani.org/", "HelloService");
>
>         ServiceFactory factory = ServiceFactory.newInstance();
>         Service        service = factory.createService(url, qname);
>
>         Hello          hello   = (Hello) service.getPort(Hello.class);
>
>         System.out.println("hello.hello(" + argument + ")");
>         System.out.println("output:" + hello.hello(argument));
>
>
>
> The error is
>
> Contacting webservice at
> http://localhost:8080/TestEJB/Hello?wsdl
> Exception in thread "main" javax.xml.rpc.ServiceException: Error processing
> WSDL document:
> java.io.IOException: Server returned HTTP response code: 500 for URL:
> http://localhost:8080/TestEJB/Hello/?wsdl
>         at org.apache.axis.client.Service.initService
> (Service.java:250)
>         at org.apache.axis.client.Service.<init>(Service.java:165)
>         at
> org.apache.axis.client.ServiceFactory.createService(ServiceFactory.java:198)
>         at HelloClient.main(HelloClient.java :27)
>
> If we can observe the error trace, a '/' is getting appended for the URL
> "http://localhost:8080/TestEJB/Hello" and making it "
> http://localhost:8080/TestEJB/Hello/?wsdl". It is not
> happening for WEBSERVICE implemented using a servlet.
>
>
>
> The WSDL is as follows.
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <definitions name="HelloService" targetNamespace="http://hello.phani.org/"
> xmlns:tns="http://hello.phani.org/" xmlns="
> http://schemas.xmlsoap.org/wsdl/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="
> http://schemas.xmlsoap.org/wsdl/soap/">
>   <types/>
>   <message name="Hello_hello">
>     <part name="String_1" type="xsd:string"/></message>
>   <message name="Hello_helloResponse">
>     <part name="result" type="xsd:string"/></message>
>   <portType name="Hello">
>     <operation name="hello" parameterOrder="String_1">
>        <input message="tns:Hello_hello"/>
>       <output
> message="tns:Hello_helloResponse"/></operation></portType>
>   <binding name="HelloBinding" type="tns:Hello">
>     <soap:binding
> transport="http://schemas.xmlsoap.org/soap/http"
> style="rpc"/>
>     <operation name="hello">
>       <soap:operation soapAction=""/>
>       <input>
>         <soap:body use="literal"
> namespace="http://hello.phani.org/"/></input>
>       <output>
>          <soap:body use="literal"
> namespace="http://hello.phani.org/"/></output></operation></binding
> >
>   <service name="HelloService">
>     <port name="HelloPort" binding="tns:HelloBinding">
>       <soap:address location="
> http://localhost:8080/TestEJB/Hello"/></port></service></definitions>
>
>
> Why is an extra '/' is getting added ?
>
> Any issues?
>
> Thanks
>
> phani
>
>
>
>
>
>
>
>
>
>
>