users@jax-rpc.java.net

Re: !!!helloWorld example- unrecognized operation

From: kathy walsh <Kathleen.Walsh_at_Sun.COM>
Date: Fri, 17 Sep 2004 11:22:00 -0400

Hello-
I'm not sure where you got urn:Foo from for the body namespace-
The correct value is the namespace below-

"http://hello.org/wsdl"



Onur Sencer wrote:

>Hi,
>I'm trying to run helloworld example on the tutorial, when I execute ant run-client, I get an exception:
>caught exception while handling request: unrecognized operation: {urn:Foo}sayHello
>
>the client code is below. Is it because the namespace URI is set not correctly? (on setoperationname function) If so, what should I write for the namespace URI? Also in this code, wsdl url of the service is not given? Is it a missing for this code?
>
>Sincerely;
>Onur Sencer
>
>
>
>package hello;
>
>import javax.xml.rpc.Call;
>import javax.xml.rpc.Service;
>import javax.xml.rpc.JAXRPCException;
>import javax.xml.namespace.QName;
>import javax.xml.rpc.ServiceFactory;
>import javax.xml.rpc.ParameterMode;
>
>public class HelloClient {
>
> private static String qnameService = "HelloWorldService";
> private static String qnamePort = "HelloIFPort";
>
> private static String BODY_NAMESPACE_VALUE =
> "urn:Foo";
> private static String ENCODING_STYLE_PROPERTY =
> "javax.xml.rpc.encodingstyle.namespace.uri";
> private static String NS_XSD =
> "http://www.w3.org/2001/XMLSchema";
> private static String URI_ENCODING =
> "http://schemas.xmlsoap.org/soap/encoding/";
>
> public static void main(String[] args) {
>
> System.out.println("Endpoint address = " + args[0]);
>
> try {
> ServiceFactory factory =
> ServiceFactory.newInstance();
> Service service =
> factory.createService(
> new QName(qnameService));
>
> QName port = new QName(qnamePort);
>
> Call call = service.createCall(port);
> call.setTargetEndpointAddress(args[0]);
>
> call.setProperty(Call.SOAPACTION_USE_PROPERTY,
> new Boolean(true));
> call.setProperty(Call.SOAPACTION_URI_PROPERTY,
> "");
> call.setProperty(ENCODING_STYLE_PROPERTY,
> URI_ENCODING);
> QName QNAME_TYPE_STRING =
> new QName(NS_XSD, "string");
> call.setReturnType(QNAME_TYPE_STRING);
>
> call.setOperationName(
> new QName(BODY_NAMESPACE_VALUE,"sayHello"));
> call.addParameter("String_1", QNAME_TYPE_STRING,
> ParameterMode.IN);
> String[] params = { "Murph!" };
>
> String result = (String)call.invoke(params);
> System.out.println(result);
>
> } catch (Exception ex) {
> ex.printStackTrace();
> }
> }
>}
>
>
>
>
>
>------------------------------------------------------------------------
>
><?xml version="1.0" encoding="UTF-8"?><definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://hello.org/wsdl" xmlns:ns2="http://hello.org/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="HelloWorldService" targetNamespace="http://hello.org/wsdl">
> <types>
> <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://hello.org/types" xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://hello.org/types">
> <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
> <complexType name="ValueType">
> <sequence>
> <element name="boolProperty" type="boolean"/>
> <element name="integerProperty" type="soap11-enc:int"/>
> <element name="stringProperty" type="string"/></sequence></complexType></schema></types>
> <!--message name="HelloIF_echoValueType">
> <part name="ValueType_1" type="ns2:ValueType"/></message>
> <message name="HelloIF_echoValueTypeResponse">
> <part name="result" type="ns2:ValueType"/></message-->
> <message name="HelloIF_sayHello">
> <part name="String_1" type="xsd:string"/></message>
> <message name="HelloIF_sayHelloResponse">
> <part name="result" type="xsd:string"/></message>
> <portType name="HelloIF">
> <!--operation name="echoValueType" parameterOrder="ValueType_1">
> <input message="tns:HelloIF_echoValueType"/>
> <output message="tns:HelloIF_echoValueTypeResponse"/></operation-->
> <operation name="sayHello" parameterOrder="String_1">
> <input message="tns:HelloIF_sayHello"/>
> <output message="tns:HelloIF_sayHelloResponse"/></operation></portType>
> <binding name="HelloIFBinding" type="tns:HelloIF">
> <!--operation name="echoValueType">
> <input>
> <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded" namespace="http://hello.org/wsdl"/></input>
> <output>
> <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded" namespace="http://hello.org/wsdl"/></output>
> <soap:operation soapAction=""/></operation-->
> <operation name="sayHello">
> <input>
> <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded" namespace="http://hello.org/wsdl"/></input>
> <output>
> <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded" namespace="http://hello.org/wsdl"/></output>
> <soap:operation soapAction=""/></operation>
> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/></binding>
> <service name="HelloWorldService">
> <port name="HelloIFPort" binding="tns:HelloIFBinding">
> <soap:address location="http://localhost:8080/jaxrpc-HelloWorld/hello" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/></port></service></definitions>
>
>
>------------------------------------------------------------------------
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
>For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net
>
>