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 sjunejo <sj...@temenos.com> on 2012/06/19 17:11:54 UTC

Web Service client generated by wsdl not working with Deployed web sevrice

I have generated a WSDL from a java class using axis2 java2wsdl utility as
follows;

java2wsdl -o C:\temp -cn com.temenos.webservices.customer.CustomerServiceWS
Then I have deployed the same web service within an Application Server (say
jBoss) in axis2 and I can browse the wsdl on http://
127.0.0.1:8080/axis2/services/CustomerServiceWS?wsdl and call the methods on
this service via standard client like SoapUI etc.

The problem is now that when I generated a client using standard java
tooling 'wsimport' by providing a WSDL location as C:\temp (Generated WSDL
from java2wsdl utility), my client is unable to communicate with the
Deployed Web Service. I am using following code to access the web service;

// Initialise WS
CustomerServiceWS service = null;
CustomerServiceWSPortType servicePort = null;
try {
URL wsdlLocation  = new
URL("http://127.0.0.1:8080/axis2/services/CustomerServiceWS?wsdl");  
QName serviceName = new QName("http://customer.webservices.temenos.com",
"CustomerServiceWS");
service = new CustomerServiceWS(wsdlLocation, serviceName);
servicePort = service.getCustomerServiceWSHttpSoap12Endpoint();
} catch (MalformedURLException murle) {
murle.printStackTrace();
    return;
}
But while creating an (service Port) Endpoint I am getting following error;

Exception in thread "main" javax.xml.ws.WebServiceException: An attempt was
made to construct the ServiceDelegate object with an service name that is
not valid: {http://customer.webservices.temenos.com}CustomerServiceWS.
    at
org.apache.axis2.jaxws.ExceptionFactory.createWebServiceException(ExceptionFactory.java:173)
    at
org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:70)
    at
org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:118)
    at org.apache.axis2.jaxws.spi.ServiceDelegate.(ServiceDelegate.java:218)
    at
org.apache.axis2.jaxws.spi.Provider.createServiceDelegate(Provider.java:59)
    at javax.xml.ws.Service.(Service.java:56)
    at
com.temenos.webservices.customer.CustomerServiceWS.(CustomerServiceWS.java:42)
    at
com.temenos.services.customer.client.Client.testGetLanguage(Client.java:32)
    at com.temenos.services.customer.client.Client.main(Client.java:21)
I have tried many things but it does not seems to like anything. Am I
missing anything?

Thanks,

--

SJunejo
-- 
View this message in context: http://old.nabble.com/Web-Service-client-generated-by-wsdl-not-working-with-Deployed-web-sevrice-tp34037097p34037097.html
Sent from the Axis - User mailing list archive at Nabble.com.

Re: Web Service client generated by wsdl not working with Deployed web sevrice

Posted by sjunejo <sj...@temenos.com>.
I fixed this problem by using following code in my client;

// Initialise WS
		CustomerServiceWS service = null;
		CustomerServiceWSPortType servicePort = null;
		try {
			URL wsdlLocation  = new
URL("http://127.0.0.1:8080/axis2/services/CustomerServiceWS?wsdl");  
			QName serviceName = new QName("http://CustomerServiceWs",
"CustomerServiceWS");
			service = new CustomerServiceWS(wsdlLocation, serviceName);
			servicePort = (CustomerServiceWSPortType)service.getPort(
														new QName("http://CustomerServiceWs",
"CustomerServiceWSHttpSoap12Endpoint"),
														CustomerServiceWSPortType.class );
		} catch (MalformedURLException murle) {
			murle.printStackTrace();
			return;
		}

And it worked but then I am getting another type mismatch problem while
invoking the method on deployed web service. Will start separate thread for
that.

Thanks,

--

SJunejo



sjunejo wrote:
> 
> I have generated a WSDL from a java class using axis2 java2wsdl utility as
> follows;
> 
> java2wsdl -o C:\temp -cn
> com.temenos.webservices.customer.CustomerServiceWS
> Then I have deployed the same web service within an Application Server
> (say jBoss) in axis2 and I can browse the wsdl on http://
> 127.0.0.1:8080/axis2/services/CustomerServiceWS?wsdl and call the methods
> on this service via standard client like SoapUI etc.
> 
> The problem is now that when I generated a client using standard java
> tooling 'wsimport' by providing a WSDL location as C:\temp (Generated WSDL
> from java2wsdl utility), my client is unable to communicate with the
> Deployed Web Service. I am using following code to access the web service;
> 
> // Initialise WS
> CustomerServiceWS service = null;
> CustomerServiceWSPortType servicePort = null;
> try {
> URL wsdlLocation  = new
> URL("http://127.0.0.1:8080/axis2/services/CustomerServiceWS?wsdl");  
> QName serviceName = new QName("http://customer.webservices.temenos.com",
> "CustomerServiceWS");
> service = new CustomerServiceWS(wsdlLocation, serviceName);
> servicePort = service.getCustomerServiceWSHttpSoap12Endpoint();
> } catch (MalformedURLException murle) {
> murle.printStackTrace();
>     return;
> }
> But while creating an (service Port) Endpoint I am getting following
> error;
> 
> Exception in thread "main" javax.xml.ws.WebServiceException: An attempt
> was made to construct the ServiceDelegate object with an service name that
> is not valid: {http://customer.webservices.temenos.com}CustomerServiceWS.
>     at
> org.apache.axis2.jaxws.ExceptionFactory.createWebServiceException(ExceptionFactory.java:173)
>     at
> org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:70)
>     at
> org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:118)
>     at
> org.apache.axis2.jaxws.spi.ServiceDelegate.<init>(ServiceDelegate.java:218)
>     at
> org.apache.axis2.jaxws.spi.Provider.createServiceDelegate(Provider.java:59)
>     at javax.xml.ws.Service.<init>(Service.java:56)
>     at
> com.temenos.webservices.customer.CustomerServiceWS.<init>(CustomerServiceWS.java:42)
>     at
> com.temenos.services.customer.client.Client.testGetLanguage(Client.java:32)
>     at com.temenos.services.customer.client.Client.main(Client.java:21)
> I have tried many things but it does not seems to like anything. Am I
> missing anything?
> 
> Thanks,
> 
> --
> 
> SJunejo
> 
-- 
View this message in context: http://old.nabble.com/Web-Service-client-generated-by-wsdl-not-working-with-Deployed-web-sevrice-tp34037097p34053376.html
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org