Hi All-
I have got the services working in Axis-Client. When I tried using WSIF, I get the
following error:
org.apache.wsif.WSIFException: Method getCustomer(class java.lang.String) was not
found in portType {http://test.gers.com}CustImpl
at org.apache.wsif.base.WSIFClientProxy.findMatchingOperation(Unknown Source)
at org.apache.wsif.base.WSIFClientProxy.invoke(Unknown Source)
at $Proxy0.getCustomer(Unknown Source)
I am new to WSIF. So any input to resolve the issue would help. I have attached the
java program and the wsdl file. The java program takes the wsdl file as an argument.
Appreciate your time.,
---------------------------------------
package com.gers.test;
import org.apache.wsif.WSIFService;
import org.apache.wsif.WSIFServiceFactory;
import org.apache.wsif.WSIFException;
import javax.xml.namespace.QName;
import java.rmi.RemoteException;
public class RunCustImplWsif {
public static void main(String[] args) {
try {
if (args.length != 1) {
System.out.println(
"Usage: wsdl");
System.exit(1);
}
// create a service factory
WSIFServiceFactory factory = WSIFServiceFactory.newInstance();
// parse WSDL
WSIFService service =
factory.getService(
args[0],
null,
null,
"http://test.gers.com",
"CustImpl");
// map types
service.mapType(
new QName("http://test.gers.com", "Customer"),
Class.forName(
"com.gers.test.Customer"));
System.out.println("before invocation....");
// create the stub
CustImpl stub = (CustImpl) service.getStub(CustImpl.class);
System.out.println("after invocation");
// do the invocation
// args[1] is the cust code
Customer cust = stub.getCustomer("1234");
} catch (WSIFException we) {
System.out.println(
"Error while executing sample, received an exception from WSIF;
details:");
we.printStackTrace();
} catch (RemoteException re) {
System.out.println(
"Error while executing sample, received an exception due to remote
invocation; details:");
re.printStackTrace();
} catch (ClassNotFoundException ce) {
System.out.println(
"Error while executing sample, could not find required class
complexsoap.client.stub.com.cdyne.ws.LatLongReturn; please add it to your classpath;
details:");
ce.printStackTrace();
}
}
}
The WSDL File:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://test.gers.com"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:intf="http://test.gers.com" xmlns:impl="http://test.gers.com"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<schema elementFormDefault="qualified" targetNamespace="http://test.gers.com"
xmlns="http://www.w3.org/2001/XMLSchema">
<element name="getCustomer">
<complexType>
<sequence>
<element name="CustId" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
</element>
<complexType name="Customer">
<sequence>
<element name="addr" nillable="true" type="xsd:string"/>
<element name="name" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
<element name="getCustomerResponse">
<complexType>
<sequence>
<element name="getCustomerReturn" nillable="true" type="impl:Customer"/>
</sequence>
</complexType>
</element>
</schema>
</wsdl:types>
<wsdl:message name="getCustomerRequest">
<wsdl:part name="parameters" element="intf:getCustomer"/>
</wsdl:message>
<wsdl:message name="getCustomerResponse">
<wsdl:part name="parameters" element="intf:getCustomerResponse"/>
</wsdl:message>
<wsdl:portType name="CustImpl">
<wsdl:operation name="getCustomer">
<wsdl:input name="getCustomerRequest" message="intf:getCustomerRequest"/>
<wsdl:output name="getCustomerResponse" message="intf:getCustomerResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="CustImplSoapBinding" type="intf:CustImpl">
<wsdlsoap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getCustomer">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="getCustomerRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getCustomerResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="CustImplService">
<wsdl:port name="CustImpl" binding="intf:CustImplSoapBinding">
<wsdlsoap:address location="http://localhost:5555/serverWeb/services/CustImpl"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>