[jboss-user] [JBossWS] - Error passing Complex Types as parameters in Web Service
nandanT
do-not-reply at jboss.com
Mon Aug 25 02:00:05 EDT 2008
Hi,
I have created a simple Hello World Web Service.
I have created a POJO HelloParam
The method exposed in the web service "sayHello" takes HelloParam object as parameter.
The WSDL is generated and is deployed successfully over JBoss.
But when I run the client, I get the following error:
Exception in thread "main" org.jboss.ws.WSException: Cannot obtain java type mapping for: {http://ejb3webservice.wipro.com/}helloParam
Following are the classes that I have created:
| package com.wipro.ejb3webservice;
|
| import java.io.Serializable;
|
| public class HelloParam implements Serializable{
| /**
| *
| */
| private static final long serialVersionUID = 5446103626304202057L;
| String firstName;
| String 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;
| }
| /**
| * @param firstName
| * @param lastName
| */
| public HelloParam(String firstName, String lastName) {
| super();
| this.firstName = firstName;
| this.lastName = lastName;
| }
| /**
| *
| */
| public HelloParam() {
|
| }
| }
|
The interface that is exposed as webservice is :
package com.wipro.ejb3webservice;
|
| import java.rmi.Remote;
|
| import javax.jws.WebService;
| import javax.jws.soap.SOAPBinding;
| import javax.jws.soap.SOAPBinding.Style;
|
|
| @WebService
| @SOAPBinding(style = Style.RPC)
| public interface HelloWorld extends Remote {
| public void sayHello(HelloParam helloParam);
| }
And the implementation of the interfaces is:
package com.wipro.ejb3webservice;
|
| import javax.ejb.Remote;
| import javax.ejb.Stateless;
| import javax.jws.WebMethod;
| import javax.jws.WebParam;
| import javax.jws.WebService;
|
|
| @Stateless
| @Remote(HelloWorld.class)
| @WebService(name="HelloWorldName" ,serviceName="HelloWorldImplService",endpointInterface = "com.wipro.ejb3webservice.HelloWorld")
| public class HelloWorldImpl implements HelloWorld {
|
| @WebMethod
| public void sayHello(
| @WebParam(name="helloParam" )
| HelloParam helloParam)
| {
| System.out.println("first name" + helloParam.getFirstName()+"last name--"+ helloParam.getLastName());
|
| }
| }
The WSDL file genereated is:
<?xml version="1.0" encoding="UTF-8"?>
| <definitions name="HelloWorldImplService" targetNamespace="http://ejb3webservice.wipro.com/" xmlns:tns="http://ejb3webservice.wipro.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/">
| <types>
| <xs:schema targetNamespace="http://ejb3webservice.wipro.com/" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
| <xs:complexType name="helloParam">
| <xs:sequence>
| <xs:element minOccurs="0" name="firstName" type="xs:string"/>
| <xs:element minOccurs="0" name="lastName" type="xs:string"/>
| </xs:sequence>
| </xs:complexType>
| </xs:schema>
| </types>
| <message name="HelloWorld_sayHelloResponse">
| </message>
| <message name="HelloWorld_sayHello">
| <part name="arg0" type="tns:helloParam">
| </part>
| </message>
| <portType name="HelloWorld">
| <operation name="sayHello" parameterOrder="arg0">
| <input message="tns:HelloWorld_sayHello">
| </input>
| <output message="tns:HelloWorld_sayHelloResponse">
| </output>
| </operation>
| </portType>
| <binding name="HelloWorldBinding" type="tns:HelloWorld">
| <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
| <operation name="sayHello">
| <soap:operation soapAction=""/>
| <input>
| <soap:body use="literal" namespace="http://ejb3webservice.wipro.com/"/>
| </input>
| <output>
| <soap:body use="literal" namespace="http://ejb3webservice.wipro.com/"/>
| </output>
| </operation>
| </binding>
| <service name="HelloWorldImplService">
| <port name="HelloWorldNamePort" binding="tns:HelloWorldBinding">
| <soap:address location="http://localhost:8080/Ejb3Webservice/HelloWorldImpl"/>
| </port>
| </service>
| </definitions>
|
Can any one help me on this issue.
Its very urgent.
Thanks and Regards
-Nandan
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4172210#4172210
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4172210
More information about the jboss-user
mailing list