[jboss-user] [JBossWS] - [JAX-RPC] DII doesn't work. [Help]

ShadenS do-not-reply at jboss.com
Tue Jul 25 10:56:12 EDT 2006


Hi JBoss Community,

With the following WSDL, how is source code of a DII client? :_(
http://slide.altervista.org/HelloBean.xml

I've created many example but they don't work. Web service is deployed in 
JBoss 4.0.4 GA.
ServiceEndpointAddress is http://notebook:8080/NewVersionAll/HelloBean?wsdl


My last DII Client obtain this error:
anonymous wrote : operation style: "rpc" not supported
  | 	at com.sun.xml.rpc.client.dii.BasicCall.unsupportedOperationStyleException(BasicCall.java:566)
  | 	at com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:498)
  | 	at src.clients.DIIClient.main(DIIClient.java:55)
  | 

I've tried to change "rpc" with "document" but without success.
Following client code:

package src.clients;
  | 
  | import java.net.URL;
  | 
  | import javax.xml.rpc.Service;
  | import javax.xml.rpc.ServiceFactory;
  | import javax.xml.rpc.Call;
  | import javax.xml.rpc.JAXRPCException;
  | import javax.xml.namespace.QName;
  | import javax.xml.rpc.ParameterMode;
  | import javax.xml.rpc.encoding.XMLType;
  | 
  | public class DIIClient {
  | 	
  | 	public static void main(String[] args) {
  | 		try {
  | 			// Create a service class with no WSDL information.  You
  | 			// still must know something about the WSDL, however: the
  | 			// service's name.
  | 			QName serviceName = new QName(
  | 					"http://notebook:8080/NewVersionAll/HelloBean?wsdl",
  | 			"Risposta");
  | 			ServiceFactory factory = ServiceFactory.newInstance();
  | 			Service service = factory.createService(serviceName);
  | 			// Now create a dynamic Call object from this service.
  | 			// This call object is not yet associated with any
  | 			// operation.  We'll do that below.
  | 			Call call = service.createCall();
  | 			// Next, build up the information about the operation...
  | 			// The operation name
  | 			QName operationName = new QName("http://org.jboss.ws/samples/jsr181ejb","reply");
  | 			call.setOperationName(operationName);
  | 			// The input parameter
  | 			call.addParameter(
  | 					"String_1",             // parameter name
  | 					XMLType.XSD_STRING, // parameter XML type QName
  | 					String.class,       // parameter Java type class
  | 					ParameterMode.IN);  // parameter mode
  | 			// The return
  | 			call.setReturnType(XMLType.XSD_STRING);
  | 			// The operation is an RPC-style operation.
  | 			call.setProperty(Call.OPERATION_STYLE_PROPERTY,"rpc");			
  | 			
  | 			// The encoding style property value comes from the
  | 			// binding's operation's input clauses encodingStyle
  | 			// attribute.  Note that, in this case, this call is not
  | 			// really necessary - the value we're setting this
  | 			// property to is the default.
  | 			/*call.setProperty(Call.ENCODINGSTYLE_URI_PROPERTY,
  | 			"http://schemas.xmlsoap.org/soap/encoding/");*/
  | 			// The target endpoint
  | 			call.setTargetEndpointAddress("http://notebook:8080/NewVersionAll/HelloBean");
  | 			
  | 			String[] params = {"ABC"};
  | 			String result = (String) call.invoke(params);
  | 			System.out.println(result);
  | 		}
  | 		catch (Throwable t) {
  | 			t.printStackTrace();
  | 		}
  | 		/**try{
  | 		 String urlstr = "http://notebook:8080/NewVersionAll/HelloBean?wsdl";
  | 		 String argument = "Aaaah!";
  | 		 System.out.println("Contacting webservice at " + urlstr);
  | 		 URL url = new URL(urlstr);
  | 		 String ns = "http://org.jboss.ws/samples/jsr181ejb";
  | 		 QName qname = new QName(ns, "Risposta");
  | 		 QName port = new QName(ns, "EndpointInterface");
  | 		 QName operation = new QName(ns, "reply");
  | 		 ServiceFactory factory = ServiceFactory.newInstance();
  | 		 Service service = factory.createService(url, qname);
  | 		 
  | 		 Call call = service.createCall(port, operation);
  | 		 call.setProperty(
  | 		 com.sun.xml.rpc.client.dii.CallPropertyConstants.CONTENT_NEGOTIATION_PROPERTY,
  | 		 "pessimistic"); 
  | 		 System.out.println("hello.hello(" + argument + ")");
  | 		 System.out.println("output:" + call.invoke(new Object[] {argument}));
  | 		 
  | 		 }catch(Exception e){
  | 		 e.printStackTrace();
  | 		 }**/
  | 	}
  | 	
  | }

Thanks to everybody!

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

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



More information about the jboss-user mailing list