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
