You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsif-user@ws.apache.org by Ioannis Kotsiopoulos <io...@cs.man.ac.uk> on 2005/07/24 18:20:57 UTC

FW: Problem with complex types

Hi,

I am trying to create a similar service with the one that already exists in
the samples (Zip2Geo) using complex types but I keep getting the following
error message.

org.apache.wsif.WSIFException: Method getRecord(class
uk.ac.manchester.informatics.www.staticproxy.GetRecord) was not found in
portType {http://www.informatics.manchester.ac.uk}AddressBookPort
	at
org.apache.wsif.base.WSIFClientProxy.findMatchingOperation(Unknown Source)
	at org.apache.wsif.base.WSIFClientProxy.invoke(Unknown Source)
	at $Proxy0.getRecord(Unknown Source)
	at
uk.ac.manchester.informatics.www.client.stub.Run.main(Run.java:60)

If anybody has an idea of how this can be fixed I would be grateful to hear
from him/her.

Thanks

Yannis

Here is the wsdl file:
<?xml version="1.0" encoding="utf-8"?>
<definitions
 xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" 
 xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
 xmlns:s="http://www.w3.org/2001/XMLSchema" 
 xmlns:s0="http://www.informatics.manchester.ac.uk"
  xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
   xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" 
   xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" 
   targetNamespace="http://www.informatics.manchester.ac.uk"
    xmlns="http://schemas.xmlsoap.org/wsdl/">
    
    
    
	<types>
		<s:schema elementFormDefault="qualified"
targetNamespace="http://www.informatics.manchester.ac.uk">
			<s:element name="GetRecord">
				<s:complexType>
					<s:sequence>
						<s:element minOccurs="0"
maxOccurs="1" name="id" type="s:string" />
						<s:element minOccurs="0"
maxOccurs="1" name="LicenseKey" type="s:string" />
					</s:sequence>
				</s:complexType>
			</s:element>
			<s:element name="GetRecordResponse">
				<s:complexType>
					<s:sequence>
						<s:element minOccurs="1"
maxOccurs="1" name="GetRecordResult" type="s0:RecordReturn" />
					</s:sequence>
				</s:complexType>
			</s:element>
			<s:complexType name="RecordReturn">
				<s:sequence>
					<s:element minOccurs="1"
maxOccurs="1" name="FirstName" type="s:string" />
					<s:element minOccurs="1"
maxOccurs="1" name="Surname" type="s:string" />

				</s:sequence>
			</s:complexType>
	
		</s:schema>
	</types>
	
	<message name="GetRecordSoapIn">
		<part name="parameters" element="s0:GetRecord" />
	</message>
	<message name="GetRecordSoapOut">
		<part name="parameters" element="s0:GetRecordResponse" />
	</message>

	<portType name="AddressBookPort">
		<operation name="getRecord">
			<documentation>This method has an input a number and
matches it to a name</documentation>
			<input message="s0:GetRecordSoapIn" />
			<output message="s0:GetRecordSoapOut" />
		</operation>
	</portType>
	<binding name="AddressBookPortBinding" type="s0:AddressBookPort">
		<soap:binding
transport="http://schemas.xmlsoap.org/soap/http" style="document" />
		<operation name="getRecord">
			<soap:operation
soapAction="http://www.informatics.manchester.ac.uk/getRecord"
style="document" />
			<input>
				<soap:body use="literal" />
			</input>
			<output>
				<soap:body use="literal" />
			</output>
		</operation>
	</binding>
	<service name="AddressBook">
		<port name="AddressBookPort"
binding="s0:AddressBookPortBinding">
			<soap:address
location="http://localhost:9080/ComplexService1/services/AddressBookPort" />
		</port>
	</service>
</definitions>

<---- And this part of the client code:  --->
package uk.ac.manchester.informatics.www.client.stub;

import org.apache.wsif.WSIFService;
import org.apache.wsif.WSIFServiceFactory;
import org.apache.wsif.WSIFException;

import uk.ac.manchester.informatics.www.staticproxy.*;
import javax.xml.namespace.QName;
import java.rmi.RemoteException;

public class Run {

public static void main(String[] args) {
        try {
            if (args.length != 2) {
                System.exit(1);
            }

            // create a service factory
            WSIFServiceFactory factory = WSIFServiceFactory.newInstance();

            // parse WSDL
        WSIFService service = factory.getService( args[0],  null, null,
"http://www.informatics.manchester.ac.uk", "AddressBookPort");
            
		// map types
            			            
            service.mapType(new
QName("http://www.informatics.manchester.ac.uk", "GetRecordResponse"),
Class.forName("uk.ac.manchester.informatics.www.GetRecordResponse"));
			service.mapType(new
QName("http://www.informatics.manchester.ac.uk", "GetRecord"),
Class.forName("uk.ac.manchester.informatics.www.GetRecord"));
			service.mapType(new
QName("http://www.informatics.manchester.ac.uk", "RecordReturn"),
Class.forName("uk.ac.manchester.informatics.www.RecordReturn"));
      		
      		      			
            // create the stub
   			AddressBookPort stub =
(AddressBookPort)service.getStub(AddressBookPort.class);
            
            // do the invocation
		   GetRecordResponse response = new GetRecordResponse();
		   GetRecord record = new GetRecord();
		   record.setId("2");
		   record.setLicenseKey("none");
		   response = stub.getRecord(record);	
 
System.out.println(response.getGetRecordResult().getFirstName());
	
System.out.println(response.getGetRecordResult().getSurname());