users@jax-rpc.java.net

java.rmi.RemoteException: Server did not recognize the value of HTTP Header SOAPAction

From: Onur Sencer <Onur.Sencer_at_telenity.com>
Date: Mon, 20 Sep 2004 10:49:27 +0300

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

On build.xml I changed the endpoint and server.url part as http://www.iter.dk/webservices/calculator.asmx. The client code is below

Thank you for your support.
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 = "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,
                 "");
            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