[xgws-user] XSUL2

Aleksander Slominski aslom_at_cs.indiana.edu
Mon, 21 Nov 2005 11:10:12 -0500


hi,

could i see your WSDL - is it doc/literal? does it have "parameters" 
name ? i guess so ...

alek

Tobias Anstett wrote:

> Hi,
>
> i am implementing a dynamic invocation component of our workflow 
> system study project. Because I read that XSUL2 supports XmlBeans in 
> request and response I'd like it instead of WSIF which can't handle 
> this so easy.
>
> Now I post my short code and the reaction on console (Please help me, 
> because i am in time trouble):
> (I think that it might be missing libs, but i don't know - i included 
> xsul_xswsdlc-2.0.8_1.jar, xsul-2.0.8_1.jar, xpp3-1.1.3.4.M.jar, 
> xpp3_xpath-1.1.3.4.M.jar)
>
> import java.io.File;
> import java.io.StringReader;
> import java.net.URI;
> import java.util.ArrayList;
> import java.util.Iterator;
> import java.util.List;
> import org.xmlpull.v1.builder.Iterable;
> import org.xmlpull.v1.builder.XmlElement;
> import org.xmlpull.v1.builder.XmlInfosetBuilder;
> import xsul.MLogger;
> import xsul.XmlConstants;
> import xsul.wsdl.WsdlBindingOperation;
> import xsul.wsdl.WsdlDefinitions;
> import xsul.wsdl.WsdlMessage;
> import xsul.wsdl.WsdlMessagePart;
> import xsul.wsdl.WsdlPortTypeOperation;
> import xsul.wsdl.WsdlResolver;
> import xsul.wsif.WSIFException;
> 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 XsulDynamicInvoker_org {
>     private final static MLogger logger = MLogger.getLogger();
>     private final static XmlInfosetBuilder builder = XmlConstants.BUILDER;
>    
>     public static void main(String[] args) throws Exception
>     {
>         System.err.println("Starting 
> "+XsulDynamicInvoker_org.class.getName());
>         WSIFProviderManager.getInstance().addProvider( new 
> xsul.wsif_xsul_soap_http.Provider() );
>
>         runClient(new String[]{
>                         "http://www.webservicex.net/stockquote.asmx?WSDL",
>                             "GetQuote", "IBM"});
>     }
>    
>     private static void runClient(String[] args) throws Exception {
>         URI base = ((new File(".")).toURI());
>        
>         String wsdlLoc = args[0];
>         String opName = args[1];
>        
>         System.err.println("invoking operation '"+opName+"' using WSDL 
> from "+wsdlLoc);
>        
>         WsdlDefinitions def = 
> WsdlResolver.getInstance().loadWsdl(base, new URI(wsdlLoc));
>        
>         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();
>        
>        
>         WsdlBindingOperation wsdlBindingOperation =  
> op.getBindingOperation();
>         WsdlPortTypeOperation wsdlPortTypeOperation = 
> wsdlBindingOperation.lookupOperation();
>         WsdlMessage wsdlInputMessage = 
> wsdlPortTypeOperation.getInput().lookupMessage();
>         Iterator wsdlMessageParts = 
> wsdlInputMessage.getParts().iterator();
>         System.out.println("Following parts were found for this 
> message:");
>         while (wsdlMessageParts.hasNext() == true) {
>         WsdlMessagePart wsdlPart = (WsdlMessagePart) 
> wsdlMessageParts.next();
>         System.out.println("- " + wsdlPart.getPartName());
>         }
>        
>        
>         XmlElement sarray = builder.parseFragmentFromReader(new 
> StringReader("<GetQuote><symbol>IBM</symbol></GetQuote>"));
>        
>         in.setObjectPart("parameters",sarray);
>        
>         boolean succes = op.executeRequestResponseOperation(in, out, 
> fault);
>         if(succes) {
>             System.out.println("received response "+out);
>         } else {
>             System.err.println("received fault "+fault);
>         }
>     }
>    
> }
>
>
>
>
>
>
> Console:
> Starting XsulDynamicInvoker_org
> invoking operation 'GetQuote' using WSDL from 
> http://www.webservicex.net/stockquote.asmx?WSDL
> Following parts were found for this message:
> - parameters
> Exception in thread "main" xsul.wsif.WSIFException: no part with name 
> 'parameters' is allowed
> at 
> xsul.wsif.impl.WSIFMessageElement.setObjectPart(WSIFMessageElement.java:288)
> at XsulDynamicInvoker_org.runClient(XsulDynamicInvoker_org.java:86)
> at XsulDynamicInvoker_org.main(XsulDynamicInvoker_org.java:45)
>


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