[jboss-user] [JBossWS] - Re: Consuming .net Web Service using JBOSSWS

vimalm do-not-reply at jboss.com
Fri Sep 22 12:29:37 EDT 2006


Ok it finally worked but I am got frustrated by looking at solution. 

Aparently 

  | Call call = service.createCall();
  | call.setOperationName(new QName ("http://xmlme.com/WebServices", "DvdBox"));	
  | 

is not sufficient and will give the stack trace given in my last reply. However when I tried this convoluted approach to acquire my call object it worked without the stack trace:


  | Call[] calls = service.getCalls(new QName("http://xmlme.com/WebServices", "AmazonBoxSoap"));
  | for(int ii=0; ii<calls.length; ii++) {
  | 	Call call = calls[ii];
  | 	QName opName = call.getOperationName();
  | 	if(opName.getLocalPart().equals("DvdBox")) {
  | 	DvdBox req = new DvdBox("Disney");
  | 	call.setProperty(Call.SOAPACTION_USE_PROPERTY, Boolean.TRUE);
  | 	call.setProperty(Call.SOAPACTION_URI_PROPERTY, "http://xmlme.com/WebServices/DvdBox");	
  | 	Object response = call.invoke(new Object[] {req});
  | 	if(response instanceof DvdBoxResponse) {
  | 		DvdBoxResponse result = (DvdBoxResponse)response;
  | 		System.out.println("Finished" + result.getDvdBoxResult());
  | 	}
  | }	
  | 

Here is the complete client code in case somebody runs into this issue:

  | URL wsdlURL = new URL("http://www.xmlme.com/WSAmazonBox.asmx?WSDL");		
  | ServiceFactoryImpl servFactory = new ServiceFactoryImpl();
  | URL mappingURL = new File("jaxrpc-mapping.xml").toURL();
  | QName qname = new QName("http://xmlme.com/WebServices", "AmazonBox");
  | ServiceImpl service = (ServiceImpl)servFactory.createService(wsdlURL, qname, mappingURL);
  | Call[] calls = service.getCalls(new QName("http://xmlme.com/WebServices", "AmazonBoxSoap"));
  | for(int ii=0; ii<calls.length; ii++) {
  | 	Call call = calls[ii];
  | 	QName opName = call.getOperationName();	
  |                 if(opName.getLocalPart().equals("DvdBox")) {
  | 		DvdBox req = new DvdBox("Disney");
  | 		call.setProperty(Call.SOAPACTION_USE_PROPERTY, Boolean.TRUE);
  | 		call.setProperty(Call.SOAPACTION_URI_PROPERTY, "http://xmlme.com/WebServices/DvdBox");	
  | 		Object response = call.invoke(new Object[] {req});
  | 		if(response instanceof DvdBoxResponse) {
  | 			DvdBoxResponse result = (DvdBoxResponse)response;
  | 			System.out.println("Finished" + result.getDvdBoxResult());
  | 		}
  | 	}
  | }
  | 

Have a good weekend!

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

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



More information about the jboss-user mailing list