Omar-
I will take a look in a bit-
K
Onur Sencer wrote:
>Hi, I implemented client part of the hello-world example on web services tutorial for another try on web service http://www.iter.dk/webservices/calculator.asmx?op=Add
>
>When I run the client code below, I get the following exception: unexpected encoding style: expected=http://schemas.xmlsoap.org/soap/encoding/, actual=
>
>What should I do to correct this exception?
>
>Thank you for your support.
>Sincerely;
>Onur Sencer
>
>/*
> * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
> * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
> */
>
>
>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 = "Calculator";
> private static String qnamePort = "CalculatorSoap";
>
> private static String BODY_NAMESPACE_VALUE =
> "http://www.iter.dk/webservices/calculator.asmx";
> 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,
> "http://www.iter.dk/webservices/calculator.asmx/Add");
> call.setProperty(ENCODING_STYLE_PROPERTY,
> URI_ENCODING);
> QName QNAME_TYPE_INTEGER =
> new QName(NS_XSD, "integer");
> call.setReturnType(QNAME_TYPE_INTEGER);
>
> call.setOperationName(
> new QName(BODY_NAMESPACE_VALUE,"Add"));
> call.addParameter("Integer_1", QNAME_TYPE_INTEGER,
> ParameterMode.IN);
> call.addParameter("Integer_2", QNAME_TYPE_INTEGER,
> ParameterMode.IN);
> Integer[] params = { new Integer(1),new Integer(2) };
>
> Integer result = (Integer)call.invoke(params);
> System.out.println(result);
>
> } catch (Exception ex) {
> ex.printStackTrace();
> }
> }
>}
>
>
>
>------------------------------------------------------------------------
>
>---------------------------------------------------------------------
>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
>
>