Webservice Client consumer
nean Mar 18, 2007 8:14 PMHello i have some problems to built a client which can use web services deployed...
My config is like :
- eclispe jboss IDE 2.0.0 beta
- jboss 4.0.5 EJB3 config
- jdk 1.5_11
i deploy normaly an EJB3.0 webservice on jboss, and my wsdl is like :
?
<definitions name="wsSiteService" targetNamespace="http://wsSite/jaws">
<types/>
?
<message name="wsSite_getDelaiProduit">
<part name="String_1" type="xsd:string"/>
</message>
?
<message name="wsSite_getDelaiProduitResponse">
<part name="result" type="xsd:int"/>
</message>
?
<message name="wsSite_getPrixProduit">
<part name="String_1" type="xsd:string"/>
</message>
?
<message name="wsSite_getPrixProduitResponse">
<part name="result" type="xsd:double"/>
</message>
?
<portType name="wsSite">
?
<operation name="getDelaiProduit" parameterOrder="String_1">
<input message="tns:wsSite_getDelaiProduit"/>
<output message="tns:wsSite_getDelaiProduitResponse"/>
</operation>
?
<operation name="getPrixProduit" parameterOrder="String_1">
<input message="tns:wsSite_getPrixProduit"/>
<output message="tns:wsSite_getPrixProduitResponse"/>
</operation>
</portType>
?
<binding name="wsSiteBinding" type="tns:wsSite">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
?
<operation name="getDelaiProduit">
<soap:operation soapAction=""/>
?
<input>
<soap:body namespace="http://wsSite/jaws" use="literal"/>
</input>
?
<output>
<soap:body namespace="http://wsSite/jaws" use="literal"/>
</output>
</operation>
?
<operation name="getPrixProduit">
<soap:operation soapAction=""/>
?
<input>
<soap:body namespace="http://wsSite/jaws" use="literal"/>
</input>
?
<output>
<soap:body namespace="http://wsSite/jaws" use="literal"/>
</output>
</operation>
</binding>
?
<service name="wsSiteService">
?
<port binding="tns:wsSiteBinding" name="wsSitePort">
<soap:address location="http://localhost:8080/SiteMarchand-ejb/wsSiteBean"/>
</port>
</service>
</definitions>
my client is like :
import java.net.MalformedURLException; import java.net.URL; import java.rmi.RemoteException; import javax.xml.namespace.QName; import javax.xml.rpc.Call; import javax.xml.rpc.Service; import javax.xml.rpc.ServiceException; import javax.xml.rpc.ServiceFactory; public class testWS { /** * @param args * @throws MalformedURLException */ public static void main(String[] args) { // TODO Auto-generated method stub String urlstr="http://localhost:8080/SiteMarchand-ejb/wsSiteBean?wsdl"; URL url=null; try { try { url = new URL(urlstr); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println("Contacting webservice at " + urlstr); String ns = "http://wsSite/jaws"; QName qname = new QName(ns,"wsSiteService"); QName port = new QName(ns, "wsSitePort"); QName operation = new QName(ns, "getPrixProduit"); ServiceFactory factory = ServiceFactory.newInstance(); Service service = factory.createService(url, qname); Call call = service.createCall(port, operation); try { Double d = (Double) call.invoke(new Object[]{"ezekiel"}); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } } catch (ServiceException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
i imported these libraries in my classpath :
jre system library 1.5_11
JbossAOP 1.3 libraries (sdk 1.5)
J2EE 1.4 Libraries (JBoss-IDE)
jboss ejb3 libraries
jbossws-client.jar
And my error returned :
Contacting webservice at http://localhost:8080/SiteMarchand-ejb/wsSiteBean?wsdl
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xerces/xs/XSModel
at org.jboss.ws.deployment.JSR109ClientMetaDataBuilder.buildMetaData(JSR109ClientMetaDataBuilder.java:106)
at org.jboss.ws.deployment.JSR109ClientMetaDataBuilder.buildMetaData(JSR109ClientMetaDataBuilder.java:82)
at org.jboss.ws.jaxrpc.ServiceImpl.<init>(ServiceImpl.java:96)
at org.jboss.ws.jaxrpc.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:157)
at org.jboss.ws.jaxrpc.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:128)
at testWS.main(testWS.java:37)
ligne 37 of testWS.java is "Service service = factory.createService(url, qname);"
So is there someone who can give me a solution or my error ?
Or maybe a tips to create automaticaly the client with my configuration...
Thanks for responses, please