Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Invoking Web Services  RSS feed

Sumit Amar
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to invoke a web service using apache's WSIF (Web Services Invocation Framework). But I'm getting the error that it can't deserialize the information. Has anyone tried other mechanisms to invoke web services? Please do post some code to successfully invoke a web service using any toolkit.
My code is given below:
import javax.wsdl.*;
import javax.activation.*;
import org.apache.wsif.*;
import javax.xml.namespace.*;
import org.apache.wsif.util.*;
import org.apache.wsif.providers.*;
import org.apache.wsif.providers.soap.apachesoap.WSIFDynamicProvider_ApacheSOAP;
import java.util.*;
class a
public static void main(String []s){
Definition def = WSIFUtils.readWSDL(null,"");
WSIFServiceFactory sf= WSIFServiceFactory.newInstance();
WSIFPluggableProviders.overrideDefaultProvider("",new WSIFDynamicProvider_ApacheSOAP());
Service service = WSIFUtils.selectService(def, null,null);
String portTypeNS = null;
String portTypeName = null;
String portName = "FlightServiceSoap";
Map portTypes = WSIFUtils.getAllItems(def, "PortType");
// Really there should be a way to specify the portType
// for now just try to find one with the portName
if (portTypes.size() > 1 && portName != null) {
for (Iterator i=portTypes.keySet().iterator(); i.hasNext(); ) {
QName qn = (QName);
if (portName.equals(qn.getLocalPart())) {
portTypeName = qn.getLocalPart();
portTypeNS = qn.getNamespaceURI();
PortType portType = WSIFUtils.selectPortType(def, portTypeNS, portTypeName);
WSIFService sq = sf.getService(def,service,portType);
WSIFPort defPort = sq.getPort();
WSIFOperation getQ = defPort.createOperation("GetFlightStatus");
WSIFMessage inMessage = getQ.createInputMessage();
WSIFMessage outMessage = getQ.createOutputMessage();
WSIFMessage fltMessage = getQ.createFaultMessage();
inMessage.setObjectPart("nFlightNo", "222");
inMessage.setObjectPart("nDayOffset", "1002");
getQ.executeRequestResponseOperation(inMessage, outMessage, fltMessage);
// fltMessage.getFloatPart("value");
}catch(Exception ex){System.out.println(ex);}
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!