Jason Dobies wrote:

For what it is worth, I am very interested in this ability as well. I
too would be interested in the prototype of the next WSIF version.


DISCLAIMER: this is very very preliminary version and at thsi stage it is just a prototype which may or may not have anything to do with next version of WSIF.

however feedback is very encouraged as of what could eb future directions/plans for WSIF (and that is the point of doing this and making code available).

i have implemented only very bare minimum of WSIF API just enough to invoke Google (see sample code below).

what is the interesting in code is that WSIFMessage can directly contain XMLInfoset and when response WSIFMessage is returned the parts inside are derived directly from XmlElement so one can access them with XPath like API:

boolean succes = op.executeRequestResponseOperation(in, out, fault);
if(succes) {
System.out.println("received response "+out);
XmlElement response = (XmlElement) out;
// return/resultElements
XmlElement resultElements = response
.requiredElement(null, "return")
.requiredElement(null, "resultElements");
// print URLs of all resutls /URL/text()
int count = 1;
for (Iterator i = resultElements.elements(null, null).iterator(); i.hasNext(); ) {
XmlElement item = (XmlElement) i.next();
System.out.println((count++)+". "+item
.element(null, "URL")
.requiredTextContent());
}
}


you can download and run code from:
http://www.extreme.indiana.edu/~aslom/bnp/sdi/

comments welcome.

thanks,

alek



package xsul_sample_google;

import java.io.File;
import java.net.URI;
import xsul.wsdl.WsdlDefinitions;
import xsul.wsdl.WsdlResolver;
import xsul.wsif.WSIFMessage;
import xsul.wsif.WSIFOperation;
import xsul.wsif.WSIFPort;
import xsul.wsif.WSIFService;
import xsul.wsif.WSIFServiceFactory;
import xsul.wsif.spi.WSIFProviderManager;

public class Client {
public static void main(String[] args) throws Exception
{
URI base = ((new File(".")).toURI());
WsdlDefinitions def = WsdlResolver.getInstance().loadWsdl(base, new URI(args[0]));
String opName = "doGoogleSearch";
String key = System.getProperty("key");
if(key == null) {
throw new RuntimeException("system property 'key' with google key is required");
}
String query = "test";
WSIFProviderManager.getInstance().addProvider( new xsul.wsif_xsul_soap_http.Provider() );
WSIFServiceFactory wsf = WSIFServiceFactory.newInstance();
WSIFService serv = wsf.getService(def);
WSIFPort port = serv.getPort();
WSIFOperation op = port.createOperation(opName);
WSIFMessage in = op.createInputMessage();
WSIFMessage out = op.createOutputMessage();
WSIFMessage fault = op.createFaultMessage();
in.setObjectPart("key", key);
in.setObjectPart("q", query);
in.setObjectPart("start", "0");
in.setObjectPart("maxResults", "10");
in.setObjectPart("filter", "true");
//restrict xsi:type="xsd:string"
in.setObjectPart("safeSearch", "false");
//lr xsi:type="xsd:string"
in.setObjectPart("ie", "latin1");
in.setObjectPart("oe","latin1");
boolean succes = op.executeRequestResponseOperation(in, out, fault);
if(succes) {
System.out.println("received response "+out);
} else {
System.out.println("received fault "+fault);
}
}
}




-----Original Message-----
From: Aleksander Slominski [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 21, 2004 12:53 PM
To: [EMAIL PROTECTED]
Subject: Re: Getting the SOAP reply



Matthieu RIOU wrote:




If this feature is not available, I would like to know if it's in the
development roadmap or will never be supported. Without having the returned XML structure directly, involving no java object transaformation, WSIF will not fulfill my needs.



hi Matthieu,


i have a small prototype that i have put together of what next WSIF version could do and that was one of features (direct access to XML Infoset) that i had implemented. the modification i did is that WSIFMessage can be backed up by actual XML content.




Actually I believe this would be pretty interesting as I can't see how
a really dynamic invocation can occur when a full knowledge of the returned structure is necessary.



agreed. however there is an interesting solution possible if WSIF can do


lazy deserialization depending on availability of deserializer or generated java classes (such as by Apache XmlBeans).

thanks,

alek





--
The best way to predict the future is to invent it - Alan Kay



Reply via email to