[jboss-user] [JBossWS] - javax.xml.ws.soap.SOAPFaultException: Port does not contain
ramkrishnatripathi
do-not-reply at jboss.com
Wed Dec 13 06:18:31 EST 2006
Hi guys,
I am using jboss4.0.4GA.
I have created a webservice to add Two numbers.
After deploying the project I get CalculatorService.wsdl
Now I want to consume the webservice by client program.
After running the client program I get the following Exception:-
So Please tell me Where I am wrong??
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Endpoint {http://hello/jaws}CalculatorPort does not contain operation meta data for: {http://hello/}add
at com.sun.xml.ws.encoding.soap.ClientEncoderDecoder.toMessageInfo(ClientEncoderDecoder.java:80)
at com.sun.xml.ws.encoding.soap.client.SOAPXMLDecoder.toMessageInfo(SOAPXMLDecoder.java:200)
at com.sun.xml.ws.protocol.soap.client.SOAPMessageDispatcher.receive(SOAPMessageDispatcher.java:549)
at com.sun.xml.ws.protocol.soap.client.SOAPMessageDispatcher.doSend(SOAPMessageDispatcher.java:288)
at com.sun.xml.ws.protocol.soap.client.SOAPMessageDispatcher.send(SOAPMessageDispatcher.java:153)
at com.sun.xml.ws.encoding.soap.internal.DelegateBase.send(DelegateBase.java:85)
at com.sun.xml.ws.client.EndpointIFInvocationHandler.implementSEIMethod(EndpointIFInvocationHandler.java:176)
at com.sun.xml.ws.client.EndpointIFInvocationHandler.invoke(EndpointIFInvocationHandler.java:105)
at $Proxy7.add(Unknown Source)
at hello.JAXWSClient.main(JAXWSClient.java:36)
Interface
=======
package hello;
import java.rmi.Remote;
import java.rmi.RemoteException;
import javax.ejb.Local;
import javax.jws.WebMethod;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
@Local
@WebService
@SOAPBinding(style=SOAPBinding.Style.RPC, use=SOAPBinding.Use.LITERAL)
public interface CalculatorInf extends Remote{
@WebMethod(operationName="add", action="urn:add")
public String add(int i, int j) throws RemoteException;
}
implementaion class
====
package hello;
import javax.jws.WebMethod;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.ejb.Stateless;
@WebService
//(endpointInterface="hello.CalculatorInf")
@Stateless
public class Calculator implements CalculatorInf {
public Calculator() {}
@WebMethod(operationName="add", action="urn:add")
public String add(int i, int j) {
int k = i +j ;
System.out.println(i + "+" + j +" = " + k);
return String.valueOf(k);
}
}
Client Program
=========
package hello;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import javax.xml.rpc.*;
public class JAXWSClient {
static String host = "localhost";
static String portType = "Calculator";
static String serviceName = "hello-servlet";
static String serviceEndpointAddress = "http://" + host + ":8080/" + serviceName;
static String nameSpace = "http://hello/jaws";
public static void main(String[] args) throws Exception {
URL wsdlLocation = new URL(serviceEndpointAddress + "/" + portType + "?WSDL");
QName serviceNameQ = new QName( nameSpace, "CalculatorPort");
Service service = Service.create(wsdlLocation, serviceNameQ);
CalculatorInf first = (CalculatorInf) service.getPort(serviceNameQ,hello.CalculatorInf.class);
System.out.println("1: " + first.add(2, 2));
}
}
WSDL
===
<definitions name="CalculatorService" targetNamespace="http://hello/jaws" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://hello/jaws" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
-
- <schema elementFormDefault="qualified" targetNamespace="http://hello/jaws" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://hello/jaws" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-
-
-
-
-
-
-
-
-
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
-
<soap:operation soapAction="" />
-
<soap:body use="literal" />
-
<soap:body use="literal" />
-
-
<soap:address location="http://RAM-KRISHNA:8080/hello-servlet/Calculator" />
=============
Thanks.........
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3993338#3993338
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3993338
More information about the jboss-user
mailing list