[jboss-user] [JBossWS] - javax.xml.rpc.JAXRPCException: Cannot obtain operation meta

kapilesh.arekar do-not-reply at jboss.com
Mon Jun 4 06:21:32 EDT 2007


Hi Folks

I am trying to resolve a problem a few days and I am stuck here. I am relatively new to webservices and trying to figure out what is the problem. I am using JBoss 4.0.5 GA which has bundled JBossWS 1.4. When I run a webservice client I get an error. Note: I have used "+++" to seperate peices of Source Code

Will appreciate if some one could point me to the problem. I am assuming that there is a problem is with some mapping file ,because I am able to invoke the sayHello method via the second method . Also I read same kind of problem faced by another person,but  had no reply posted 
http://lists.jboss.org/pipermail/jbossws-users/2007-January/001196.html
Note - I picked up the server code from example stated in the URL below
http://www.soapui.org/jbossws/topdown_example.html

Thanks a ton in advance
+++++++++++++++++++++++++++++++++++
ERROR
+++++++++++++++++++++++++++++++++++
Contacting webservice at http://localhost:8080/HelloWorld
output:Hello How are you, Kapilesh!
Exception in thread "main" javax.xml.rpc.JAXRPCException: Cannot obtain operation meta data for: {http://localhost:8080/HelloWorld}sayHello
	at org.jboss.ws.jaxrpc.CallImpl.getOperationMetaData(CallImpl.java:840)
	at org.jboss.ws.jaxrpc.CallImpl.getOperationMetaData(CallImpl.java:820)
	at org.jboss.ws.jaxrpc.CallImpl.invokeInternal(CallImpl.java:618)
	at org.jboss.ws.jaxrpc.CallImpl.invoke(CallImpl.java:404)
	at helloworld.client.HelloClient.main(HelloClient.java:50)
+++++++++++++++++++++++++++++++++++++++++++++
I am invoking the webservice in 2 ways . One fetching the remote interface and one use a CallImpl

My client code is as follows :-
+++++++++++++++++++++++++++++++++++++++++++++++

package helloworld.client;

import helloworld.*;

import javax.xml.rpc.Service;
import javax.xml.rpc.Call;
import javax.xml.rpc.ServiceFactory;
import org.jboss.ws.jaxrpc.ServiceImpl;
import org.jboss.ws.jaxrpc.CallImpl;
import org.jboss.ws.jaxrpc.encoding.*;
import javax.xml.namespace.QName;

import java.net.URL;

public class HelloClient
{
    public static void main(String[] args)
        throws Exception
    {
        String TARGET_NAMESPACE   = "http://localhost:8080/HelloWorld";
        String argument = "Kapilesh";

        System.out.println("Contacting webservice at " + TARGET_NAMESPACE );
        ServiceFactory factory = ServiceFactory.newInstance();
        URL wsdlLoction =  new URL(TARGET_NAMESPACE+"?wsdl");
        QName serviceName = new QName(TARGET_NAMESPACE,
                                "HelloWorldService");

        
        ServiceImpl service = (ServiceImpl)factory.createService(wsdlLoction, serviceName);
        QName operationName = new QName(TARGET_NAMESPACE, "sayHello");
        //first method
      IHelloWorld hello = (IHelloWorld) service.getPort(IHelloWorld.class);

       // System.out.println("hello.hello(" + argument + ")");
       System.out.println("output:" + hello.sayHello(argument));
        

        

       CallImpl call = (CallImpl)service.createCall();    
       call.setOperationName(operationName);
    
     //   System.out.println(call.isParameterAndReturnSpecRequired(operationName));
     // second method
       Object retObj = call.invoke(new Object[]{argument});

        
        
    }
}
+++++++++++++++++++++++++++++++++++++++++++++++
I have deployed a webservice on a server and I am able to deploy it sucessfully...
15:08:30,968 WARN  [PortComponentMetaData] <wsdl-port> element in webservices.xml not namespace qualified: HelloWorldPort
15:08:31,437 WARN  [JSR109ServerMetaDataBuilder] Adding wsdl targetNamespace to: {http://localhost:8080/HelloWorld/}HelloWorldPort
15:08:31,812 INFO  [TomcatDeployer] deploy, ctxPath=/HelloWorld, warUrl=.../tmp/deploy/tmp52320HelloWorld-exp.war/
15:08:32,062 INFO  [WSDLFilePublisher] WSDL published to: file:/C:/jboss-4.0.5.GA/server/default/data/wsdl/HelloWorld.war/HelloWorld.wsdl
15:08:32,093 INFO  [ServiceEndpointManager] WebService started: http://localhost:8080/HelloWorld
++++++++++++++++++++++++++++++++++++++++++++++++
On the server side I have the following files deployed



WEB-INF/classes/helloworld/HelloWorldService.class
WEB-INF/classes/helloworld/IHelloWorld.class
WEB-INF/classes/helloworld/impl/HelloWorld.class
WEB-INF/classes/HelloWorld-mapping.xml
WEB-INF/HelloWorld-mapping.xml
WEB-INF/jaxrpc-mapping.xml
WEB-INF/web.xml
WEB-INF/webservices.xml
WEB-INF/wsdl/HelloWorld.wsdl

++++++++++++++++++++++++++++++++++++++++++++++
webservices.xml
++++++++++++++++++++++++++++++++++++++++++++++
<?xml version="1.0" encoding="UTF-8"?>
<webservices version="1.1" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:impl="http://localhost:8080/HelloWorld/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 
<webservice-description>
  <webservice-description-name>HelloWorld</webservice-description-name>
  <wsdl-file>WEB-INF/wsdl/HelloWorld.wsdl</wsdl-file>
  <jaxrpc-mapping-file>WEB-INF/HelloWorld-mapping.xml</jaxrpc-mapping-file>
  <port-component>
   <port-component-name>IHelloWorldPort</port-component-name>
   <wsdl-port>HelloWorldPort</wsdl-port>
   <service-endpoint-interface>helloworld.IHelloWorld</service-endpoint-interface>
   <service-impl-bean>
    <servlet-link>HelloWorld</servlet-link>
   </service-impl-bean>
  </port-component>
 </webservice-description>
++++++++++++++++++++++++++++++++++++++++++++++++
web.xml
++++++++++++++++++++++++++++++++++++++++++++++++
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee">
  
    <servlet-name>HelloWorld</servlet-name>
    <servlet-class>helloworld.impl.HelloWorld</servlet-class>
  
  <servlet-mapping>
    <servlet-name>HelloWorld</servlet-name>
    <url-pattern>/*</url-pattern>
  </servlet-mapping>
</web-app>
++++++++++++++++++++++++++++++++++++++++++++++++
jax-rpc-mapping.xml
++++++++++++++++++++++++++++++++++++++++++++++++
<?xml version="1.0" encoding="UTF-8"?>

<java-wsdl-mapping version="1.1" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<package-mapping>
  <package-type>helloworld</package-type>
  http://localhost:8080/HelloWorld/
 </package-mapping><service-interface-mapping>
  <service-interface>helloworld.HelloWorld</service-interface>
  <wsdl-service-name xmlns:serviceNS="http://localhost:8080/HelloWorld/">serviceNS:HelloWorld</wsdl-service-name>
  <port-mapping>
   <port-name>IHelloWorldPort</port-name>
   <java-port-name>IHelloWorldPort</java-port-name>
  </port-mapping>
 </service-interface-mapping><service-endpoint-interface-mapping>
  <service-endpoint-interface>helloworld.IHelloWorld</service-endpoint-interface>
  <wsdl-port-type xmlns:portTypeNS="http://localhost:8080/HelloWorld/">portTypeNS:IHelloWorld</wsdl-port-type>
  <wsdl-binding xmlns:bindingNS="http://localhost:8080/HelloWorld/">bindingNS:IHelloWorldBinding</wsdl-binding>
  <service-endpoint-method-mapping>
   <java-method-name>sayHello</java-method-name>
   <wsdl-operation>sayHello</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://localhost:8080/HelloWorld/">wsdlMsgNS:IHelloWorld_sayHello</wsdl-message>
     <wsdl-message-part-name>String_1</wsdl-message-part-name>
     <parameter-mode>IN</parameter-mode>
    </wsdl-message-mapping>
   </method-param-parts-mapping>
   <wsdl-return-value-mapping>
    <method-return-value>java.lang.String</method-return-value>
    <wsdl-message xmlns:wsdlMsgNS="http://localhost:8080/HelloWorld/">wsdlMsgNS:IHelloWorld_sayHelloResponse</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>
++++++++++++++++++++++++++++++++++++++++++++++++

HelloWorld-mapping.xml
++++++++++++++++++++++++++++++++++++++++++++++++
<?xml version='1.0' encoding='UTF-8'?><java-wsdl-mapping version='1.1' 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 '>
 <package-mapping>
  <package-type>helloworld</package-type>
  http://localhost:8080/HelloWorld/
 </package-mapping>
 <service-interface-mapping>
  <service-interface>helloworld.HelloWorldService</service-interface>
  <wsdl-service-name xmlns:serviceNS='http://localhost:8080/HelloWorld/'>serviceNS:HelloWorldService</wsdl-service-name>
  <port-mapping>
   <port-name>HelloWorldPort</port-name>
   <java-port-name>HelloWorldPort</java-port-name>
  </port-mapping>
 </service-interface-mapping>
 <service-endpoint-interface-mapping>
  <service-endpoint-interface>helloworld.IHelloWorld</service-endpoint-interface>
  <wsdl-port-type xmlns:portTypeNS='http://localhost:8080/HelloWorld/'>portTypeNS:IHelloWorld</wsdl-port-type>
  <wsdl-binding xmlns:bindingNS='http://localhost:8080/HelloWorld/'>bindingNS:HelloWorld</wsdl-binding>
  <service-endpoint-method-mapping>
   <java-method-name>sayHello</java-method-name>
   <wsdl-operation>sayHello</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://localhost:8080/HelloWorld/'>wsdlMsgNS:sayHelloRequest</wsdl-message>
     <wsdl-message-part-name>sayHelloRequest</wsdl-message-part-name>
     <parameter-mode>IN</parameter-mode>
    </wsdl-message-mapping>
   </method-param-parts-mapping>
   <wsdl-return-value-mapping>
    <method-return-value>java.lang.String</method-return-value>
    <wsdl-message xmlns:wsdlMsgNS='http://localhost:8080/HelloWorld/'>wsdlMsgNS:sayHelloResponse</wsdl-message>
    <wsdl-message-part-name>sayHelloResponse</wsdl-message-part-name>
   </wsdl-return-value-mapping>
  </service-endpoint-method-mapping>
 </service-endpoint-interface-mapping>
</java-wsdl-mapping>
++++++++++++++++++++++++++++++++++++++++++++++++

HelloWorld.wsdl
++++++++++++++++++++++++++++++++++++++++++++++++
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="HelloWorld"
	targetNamespace="http://localhost:8080/HelloWorld/"
	xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
	xmlns:tns="http://localhost:8080/HelloWorld/"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
	<wsdl:types/>
	<wsdl:message name="sayHelloRequest">
		<wsdl:part name="sayHelloRequest" type="xsd:string"></wsdl:part>
	</wsdl:message>
	<wsdl:message name="sayHelloResponse">
		<wsdl:part name="sayHelloResponse" type="xsd:string"></wsdl:part>
	</wsdl:message>
	<wsdl:portType name="IHelloWorld">
		<wsdl:operation name="sayHello">
			<wsdl:input message="tns:sayHelloRequest"></wsdl:input>
			<wsdl:output message="tns:sayHelloResponse"></wsdl:output>
		</wsdl:operation>
	</wsdl:portType>
	<wsdl:binding name="HelloWorld" type="tns:IHelloWorld">
		<soap:binding style="rpc"
			transport="http://schemas.xmlsoap.org/soap/http" />
		<wsdl:operation name="sayHello">
			<soap:operation
				soapAction="http://localhost:8080/HelloWorld/sayHello" />
			<wsdl:input>
				<soap:body use="literal"
					namespace="http://localhost:8080/HelloWorld/" />
			</wsdl:input>
			<wsdl:output>
				<soap:body use="literal"
					namespace="http://localhost:8080/HelloWorld/" />
			</wsdl:output>
		</wsdl:operation>
	</wsdl:binding>
	<wsdl:service name="HelloWorldService">
		<wsdl:port name="HelloWorldPort" binding="tns:HelloWorld">
			<soap:address location="http://localhost:8080/HelloWorld" />
		</wsdl:port>
	</wsdl:service>
</wsdl:definitions>
+++++++++++++++++++++++++++++++++++++++++++++++
My Java Class Files are as follows :-

/*  
* JBoss, the OpenSource EJB server
* Distributable under LGPL license. See terms of license at gnu.org.
*/

//Auto Generated by jbossws - Please do not edit!!!

package helloworld;


import javax.xml.rpc.*; 


public interface  HelloWorldService extends  javax.xml.rpc.Service
{

     public helloworld.IHelloWorld getHelloWorldPort() throws ServiceException;

}

+++++++++++++++++++++++++++++++++++
/*
 * JBossWS WS-Tools Generated Source
 *
 * Generation Date: Mon Jun 04 14:47:16 IST 2007
 *
 * This generated source code represents a derivative work of the input to
 * the generator that produced it. Consult the input for the copyright and
 * terms of use that apply to this source code.
 */
package helloworld;
public interface  IHelloWorld extends java.rmi.Remote
{

  public java.lang.String  sayHello(java.lang.String sayHelloRequest) throws  java.rmi.RemoteException;
}
+++++++++++++++++++++++++++++++++++++++++++++
HelloWorld.java
++++++++++++++++++++++++++++++++++
package helloworld.impl;

import helloworld.IHelloWorld;

public class HelloWorld implements IHelloWorld 
{
	public String sayHello(String sayHelloRequest) 
	{
		return "Hello How are you, " + sayHelloRequest + "!";
	}
}









View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4050878#4050878

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4050878



More information about the jboss-user mailing list