Here is the client class code.

package client;

import javax.xml.rpc.Service;
import javax.xml.rpc.JAXRPCException;
import javax.xml.namespace.QName;
import javax.xml.rpc.Call;
import javax.xml.rpc.ServiceFactory;
import javax.xml.rpc.ParameterMode;

public class CPRWebServiceClient {
        

            private static String qnameService = "CPRWebServices";
            private static String qnamePort = "CPRWSIF";

            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) {

                String endpointAddress = 
"http://gupta:8080/cprwebservices/cprws";;

                try {
                    ServiceFactory factory = ServiceFactory.newInstance();
                    Service service = factory.createService(new 
QName(qnameService));
            
                    QName port = new QName(qnamePort);
            
                    Call call = service.createCall(port);
                    call.setTargetEndpointAddress(endpointAddress);
            
                    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 = { "Himanshu!" };

                    String result = (String)call.invoke(params);
                    System.out.println(result);

                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }


}

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

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


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to