Lorenzi, Michael wrote:
I simplified my program such that it works with the old wsif, but failes with
the error I wrote before if I just replace the libraries.
the classes and the package used for the mapping in the line
sq.mapPackage(typesNS, "complextypes.GoogleSearch");
exist. The new version of wsif using axis-1.2 just can't find the classes. I
saw there a lot of changes with all the WSIFMappingConvention etc. I couldn't
find the place where the classes are actually loaded (the method was
resolveMapping() in the old version)
it seems you are missing mapping for "GoogleSearchResult" ("return" is
output declared in WSDL as <part name="return"
type="typens:GoogleSearchResult"/>) and you have only mapping for
GoogleSearch (which is input AFAIR)- did you try to set it?
i will take a look into it but it will takes some time (when i get
around to do some real work on WSIF source code...)
all this mapping got over years pretty complicated :(
alek
Thank you
Michael
package src;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import javax.wsdl.Definition;
import javax.wsdl.Message;
import javax.wsdl.Part;
import javax.wsdl.PortType;
import javax.wsdl.Service;
import javax.xml.namespace.QName;
import org.apache.wsif.WSIFException;
import org.apache.wsif.WSIFMessage;
import org.apache.wsif.WSIFOperation;
import org.apache.wsif.WSIFPort;
import org.apache.wsif.WSIFService;
import org.apache.wsif.WSIFServiceFactory;
import org.apache.wsif.schema.Parser;
import org.apache.wsif.schema.SchemaType;
import org.apache.wsif.util.WSIFUtils;
public class Run {
public static void main(String[] args) throws Exception {
Definition def =
WSIFUtils.readWSDL(null,"http://api.google.com/GoogleSearch.wsdl");
Service service = def.getService(null);
PortType porttype = def.getPortType(null);
WSIFService sq =
WSIFServiceFactory.newInstance().getService(def, service, porttype);
WSIFPort port = sq.getPort();
WSIFOperation operation =
port.createOperation("doGoogleSearch");
WSIFMessage input = operation.createInputMessage();
WSIFMessage output = operation.createOutputMessage();
WSIFMessage fault = operation.createFaultMessage();
// Get the schema namespace
ArrayList schemaTypes = new ArrayList();
Parser.getAllSchemaTypes(def, schemaTypes, null);
String typesNS;
if (schemaTypes.isEmpty() != true) typesNS = ((SchemaType)
schemaTypes.get(0)).getTypeName().getNamespaceURI();
else typesNS = def.getTargetNamespace();
sq.mapPackage(typesNS, "complextypes.GoogleSearch");
Map InputMap = new HashMap();
Map OutputMap = new HashMap();
InputMap.put("filter",new Boolean("true"));
InputMap.put("key","SwY/mvFQFHKePiGQHKMA4ww0YbP7pWiB");
InputMap.put("maxResults", new Integer(10));
InputMap.put("q","JOpera");
InputMap.put("restrict","no");
InputMap.put("safeSearch",new Boolean("true"));
InputMap.put("start", new Integer(1));
InputMap.put("lr","");
InputMap.put("oe","");
InputMap.put("ie","");
// Set Parameters for the Input Message from the Job Input Map
String partName;
Object partValue;
Message in = input.getMessageDefinition();
Iterator it = in.getParts().values().iterator();
while (it.hasNext()) {
Part p = (Part) it.next();
partName = p.getName();
partValue = InputMap.get(partName);
InputMap.remove(partName);
input.setObjectPart(partName, partValue);
}
if (InputMap.isEmpty() != true) {
Iterator notused = InputMap.keySet().iterator();
while (notused.hasNext()) {
partName = (String) notused.next();
partValue = InputMap.get(partName);
input.setObjectPart(partName, partValue);
}
}
try {
//Invoke the Web Service
Iterator partNames;
if (operation.executeRequestResponseOperation(input,
output, fault)) {
//Put the Results of the Invocation to the Job
Output Map
partNames = output.getPartNames();
while (partNames.hasNext()) {
partName = (String) partNames.next();
partValue =
output.getObjectPart(partName);
OutputMap.put(partName,partValue);
}
} else {
// Print Fault Message
Iterator i = fault.getPartNames();
String partname = "";
while (i.hasNext()) {
partname =(String) i.next();
System.err.println("Fault Message" + " -
" + fault.getObjectPart(partname));
}
}
} catch (WSIFException we) {
System.err.println("Exception invoking the WS: " +
we.getMessage());
we.printStackTrace();
}
}
}
-----Urspr�ngliche Nachricht-----
Von: Aleksander Slominski [mailto:[EMAIL PROTECTED]
Gesendet: Fr 03.06.2005 19:21
An: [email protected]
Betreff: Re: Problems with update to WSIF nightly build (wsif-2.0.1_IB3)
Lorenzi, Michael wrote:
hi all,
I wanted to update to axis-1.2. Now, WSIF can't find my generated classes i use
for the type-mapping.
I made a custom ClassLoader and set it with setContextClassLoader() at the
beginning. That works fine with the old WSIF. With the nightly build, i get the
error:
EXIT WSIFDefaultMessage.getObjectPart(org.xml.sax.SAXException: Deserializing
parameter 'return': could not find deserializer for type
{urn:GoogleSearch}GoogleSearchResult)
Looks like it can't find my classes anymore. Is there any change in loading the
classes for the mapping in the new build of WSIF?
i do not think there was any architectural change - how to reproduce
your error (in few easy steps ...)?
thanks,
alek
--
The best way to predict the future is to invent it - Alan Kay