Hello,
I'm in a bit of a bind.
I'm working with webservices in jboss 4.0.2.
Trying a simple test at first.
I've successfully deployed a webservice.
However I have a problem when trying to access it using the a Dynamic Proxy Client. The
problem
happens when I use a complex type.
I get the following exception:
java.rmi.RemoteException: null; nested exception is:
java.lang.reflect.UndeclaredThrowableException
at org.jboss.webservice.client.PortProxy.invoke(PortProxy.java:176)
at $Proxy1.createPerson(Unknown Source)
at com.mine.ws.client.WSEchoClient.main(WSEchoClient.java:65)
Caused by: java.lang.reflect.UndeclaredThrowableException
at $Proxy0.createPerson(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.webservice.client.PortProxy.invoke(PortProxy.java:105)
... 2 more
Caused by: org.xml.sax.SAXException: Deserializing parameter 'result': could not
find deserializer for type {http://trials.ws.mine.com}Person
at org.jboss.axis.message.RPCHandler.onStartChild(RPCHandler.java:326)
at
org.jboss.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:1168)
at org.jboss.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:244)
at
org.jboss.axis.message.SOAPElementAxisImpl.publishToHandler(SOAPElementAxisImpl.java:1386)
at org.jboss.axis.message.RPCElement.deserialize(RPCElement.java:262)
at org.jboss.axis.message.RPCElement.getParams(RPCElement.java:396)
at org.jboss.axis.client.Call.invoke(Call.java:2662)
at org.jboss.axis.client.Call.invoke(Call.java:2538)
at org.jboss.axis.client.Call.invokeInternal(Call.java:1976)
at org.jboss.axis.client.Call.invoke(Call.java:1914)
at org.jboss.webservice.client.CallImpl.invoke(CallImpl.java:265)
at org.jboss.axis.client.AxisClientProxy.invoke(AxisClientProxy.java:381)
... 8 more
/**********************************************************************************************/
/* running in eclipse ide with the following jars in classpath:
*/
/**********************************************************************************************/
axis-ws4ee.jar
jboss-w4ee-client.jar
wsdl4.jar
activation.jar
commons-discovery.jar
jbossall-client.jar
/**********************************************************************************************/
/* Simple Serializable bean containing just two strings
*/
/**********************************************************************************************/
package com.mine.ws.model;
public class Person implements java.io.Serializable {
private String firstname;
private String lastname;
/**
*
*/
public Person() {
}
/**
* @param firstname
* @param lastname
*/
public Person(String firstname, String lastname) {
super();
this.firstname = firstname;
this.lastname = lastname;
}
/**
* @return the firstname
*/
public String getFirstname() {
return firstname;
}
/**
* @param firstname the firstname to set
*/
public void setFirstname(String firstname) {
this.firstname = firstname;
}
/**
* @return the lastname
*/
public String getLastname() {
return lastname;
}
/**
* @param lastname the lastname to set
*/
public void setLastname(String lastname) {
this.lastname = lastname;
}
}
/**********************************************************************************************/
WS CLIENT CODE
/**********************************************************************************************/
package com.mine.ws.client;
import java.net.MalformedURLException;
import java.net.URL;
import java.rmi.RemoteException;
import java.util.HashMap;
import java.util.Map;
import javax.xml.namespace.QName;
import javax.xml.rpc.Service;
import javax.xml.rpc.ServiceException;
import javax.xml.rpc.ServiceFactory;
import com.mine.ws.model.Person;
import com.mine.ws.trials.IEchoService;
public class WSEchoClient {
public static void main(String[] args) {
try {
String url
="http://localhost:8080/ejb-trials-j2ee/ws-trials-j2ee/EchoService?wsdl";
String namespace = "http://trials.ws.mine.com";
String servicename = "EchoService";
URL wsdlUrl = new URL(url);
QName qname = new QName(namespace,servicename);
ServiceFactory factory = ServiceFactory.newInstance();
Service service = factory.createService(wsdlUrl,qname);
IEchoService echoService = (IEchoService) service.getPort(IEchoService.class);
String firstname ="Clark";
String lastname = "Kent";
Person person = echoService.createPerson(firstname, lastname);
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (RemoteException e) {
e.printStackTrace();
} catch (ServiceException e) {
e.printStackTrace();
}
}
}
/**********************************************************************************************/
Generated WSDL using wscompile as noted in jboss docs
/**********************************************************************************************/
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="EchoService"
targetNamespace="http://trials.ws.mine.com"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://trials.ws.mine.com"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<schema targetNamespace="http://trials.ws.mine.com"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="http://trials.ws.mine.com"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
<soap:operation soapAction=""/>
<soap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://trials.ws.mine.com" use="encoded"/>
<soap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://trials.ws.mine.com" use="encoded"/>
<soap:address
location="http://localhost:8080/ejb-trials-j2ee/ws-trials-j2ee/EchoService"/>
/**********************************************************************************************/
mapping.xml generated from wscompile
/**********************************************************************************************/
<?xml version="1.0" encoding="UTF-8"?>
<java-wsdl-mapping
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://www.ibm.com/webservices/xsd/j2ee_jaxrpc_mapping_1_1.xsd">
<package-mapping>
<package-type>com.mine.ws.trials</package-type>
http://trials.ws.mine.com
</package-mapping>
<package-mapping>
<package-type>com.mine.ws.trials</package-type>
http://trials.ws.mine.com
</package-mapping>
<java-xml-type-mapping>
<java-type>com.mine.ws.model.Person</java-type>
<root-type-qname
xmlns:typeNS="http://trials.ws.mine.com">typeNS:Person</root-type-qname>
<qname-scope>complexType</qname-scope>
<variable-mapping>
<java-variable-name>firstname</java-variable-name>
<xml-element-name>firstname</xml-element-name>
</variable-mapping>
<variable-mapping>
<java-variable-name>lastname</java-variable-name>
<xml-element-name>lastname</xml-element-name>
</variable-mapping>
</java-xml-type-mapping>
<service-interface-mapping>
<service-interface>com.mine.ws.trials.EchoService</service-interface>
<wsdl-service-name
xmlns:serviceNS="http://trials.ws.mine.com">serviceNS:EchoService</wsdl-service-name>
<port-mapping>
<port-name>IEchoServicePort</port-name>
<java-port-name>IEchoServicePort</java-port-name>
</port-mapping>
</service-interface-mapping>
<service-endpoint-interface-mapping>
<service-endpoint-interface>com.mine.ws.trials.IEchoService</service-endpoint-interface>
<wsdl-port-type
xmlns:portTypeNS="http://trials.ws.mine.com">portTypeNS:IEchoService</wsdl-port-type>
<wsdl-binding
xmlns:bindingNS="http://trials.ws.mine.com">bindingNS:IEchoServiceBinding</wsdl-binding>
<service-endpoint-method-mapping>
<java-method-name>createPerson</java-method-name>
<wsdl-operation>createPerson</wsdl-operation>
<method-param-parts-mapping>
<param-position>0</param-position>
<param-type>java.lang.String</param-type>
<wsdl-message-mapping>
<wsdl-message
xmlns:wsdlMsgNS="http://trials.ws.mine.com">wsdlMsgNS:IEchoService_createPerson</wsdl-message>
<wsdl-message-part-name>String_1</wsdl-message-part-name>
<parameter-mode>IN</parameter-mode>
</wsdl-message-mapping>
</method-param-parts-mapping>
<method-param-parts-mapping>
<param-position>1</param-position>
<param-type>java.lang.String</param-type>
<wsdl-message-mapping>
<wsdl-message
xmlns:wsdlMsgNS="http://trials.ws.mine.com">wsdlMsgNS:IEchoService_createPerson</wsdl-message>
<wsdl-message-part-name>String_2</wsdl-message-part-name>
<parameter-mode>IN</parameter-mode>
</wsdl-message-mapping>
</method-param-parts-mapping>
<wsdl-return-value-mapping>
<method-return-value>com.mine.ws.model.Person</method-return-value>
<wsdl-message
xmlns:wsdlMsgNS="http://trials.ws.mine.com">wsdlMsgNS:IEchoService_createPersonResponse</wsdl-message>
<wsdl-message-part-name>result</wsdl-message-part-name>
</wsdl-return-value-mapping>
</service-endpoint-method-mapping>
</service-endpoint-interface-mapping>
</java-wsdl-mapping>
/**********************************************************************************************/
config file used as parameter to wscompile
/**********************************************************************************************/
<?xml version="1.0" encoding="UTF-8"?>
/**********************************************************************************************/
webservices file
/**********************************************************************************************/
<webservices
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://www.ibm.com/webservices/xsd/j2ee_web_services_1_1.xsd"
version="1.1">
<webservice-description>
<webservice-description-name>EchoService</webservice-description-name>
<wsdl-file>META-INF/wsdl/EchoService.wsdl</wsdl-file>
<jaxrpc-mapping-file>META-INF/mapping.xml</jaxrpc-mapping-file>
<port-component>
<port-component-name>EchoService</port-component-name>
<wsdl-port
xmlns:pfx="http://trials.ws.mine.com/">pfx:IEchoServicePort&...
<service-endpoint-interface>com.mine.ws.trials.IEchoService</service-endpoint-interface>
<service-impl-bean>
<ejb-link>EchoServiceBean</ejb-link>
</service-impl-bean>
</port-component>
</webservice-description>
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4099330#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...