[xgws-user] XSUL2
Tobias Anstett
anstetts_at_studi.informatik.uni-stuttgart.de
Mon, 21 Nov 2005 11:10:10 +0100
--Apple-Mail-1--358212207
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
delsp=yes;
format=flowed
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)
--Apple-Mail-1--358212207
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
charset=ISO-8859-1
<HTML><BODY style=3D"word-wrap: break-word; -khtml-nbsp-mode: space; =
-khtml-line-break: after-white-space; ">Hi,<DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>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.</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>Now I post my short code =
and the reaction on console (Please help me, because i am in time =
trouble):</DIV><DIV>(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)</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>import =
java.io.File;</DIV><DIV>import java.io.StringReader;</DIV><DIV>import =
java.net.URI;</DIV><DIV>import java.util.ArrayList;</DIV><DIV>import =
java.util.Iterator;</DIV><DIV>import java.util.List;</DIV><DIV>import =
org.xmlpull.v1.builder.Iterable;</DIV><DIV>import =
org.xmlpull.v1.builder.XmlElement;</DIV><DIV>import =
org.xmlpull.v1.builder.XmlInfosetBuilder;</DIV><DIV>import =
xsul.MLogger;</DIV><DIV>import xsul.XmlConstants;</DIV><DIV>import =
xsul.wsdl.WsdlBindingOperation;</DIV><DIV>import =
xsul.wsdl.WsdlDefinitions;</DIV><DIV>import =
xsul.wsdl.WsdlMessage;</DIV><DIV>import =
xsul.wsdl.WsdlMessagePart;</DIV><DIV>import =
xsul.wsdl.WsdlPortTypeOperation;</DIV><DIV>import =
xsul.wsdl.WsdlResolver;</DIV><DIV>import =
xsul.wsif.WSIFException;</DIV><DIV>import =
xsul.wsif.WSIFMessage;</DIV><DIV>import =
xsul.wsif.WSIFOperation;</DIV><DIV>import =
xsul.wsif.WSIFPort;</DIV><DIV>import =
xsul.wsif.WSIFService;</DIV><DIV>import =
xsul.wsif.WSIFServiceFactory;</DIV><DIV>import =
xsul.wsif.spi.WSIFProviderManager;</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>public class =
XsulDynamicInvoker_org {</DIV><DIV>=A0 =A0 private final static MLogger =
logger =3D MLogger.getLogger();</DIV><DIV>=A0 =A0 private final static =
XmlInfosetBuilder builder =3D XmlConstants.BUILDER;</DIV><DIV>=A0 =A0 =
</DIV><DIV>=A0 =A0 public static void main(String[] args) throws =
Exception</DIV><DIV>=A0 =A0 {</DIV><DIV>=A0 =A0 =A0 =A0 =
System.err.println("Starting =
"+XsulDynamicInvoker_org.class.getName());</DIV><DIV>=A0 =A0 =A0 =A0 =
WSIFProviderManager.getInstance().addProvider( new =
xsul.wsif_xsul_soap_http.Provider() );</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>=A0 =A0 =A0 =A0 =
runClient(new String[]{</DIV><DIV>=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 "<A =
href=3D"http://www.webservicex.net/stockquote.asmx?WSDL">http://www.webser=
vicex.net/stockquote.asmx?WSDL</A>",</DIV><DIV>=A0 =A0 =A0 =A0 =A0 =A0 =A0=
=A0 =A0 =A0 =A0 =A0 =A0 =A0 "GetQuote", "IBM"});</DIV><DIV>=A0 =A0 =
}</DIV><DIV>=A0 =A0 </DIV><DIV>=A0 =A0 private static void =
runClient(String[] args) throws Exception {</DIV><DIV>=A0 =A0 =A0 =A0 =
URI base =3D ((new File(".")).toURI());</DIV><DIV>=A0 =A0 =A0 =A0 =
</DIV><DIV>=A0 =A0 =A0 =A0 String wsdlLoc =3D args[0];</DIV><DIV>=A0 =A0 =
=A0 =A0 String opName =3D args[1];</DIV><DIV>=A0 =A0 =A0 =A0 =
</DIV><DIV>=A0 =A0 =A0 =A0 System.err.println("invoking operation =
'"+opName+"' using WSDL from "+wsdlLoc);</DIV><DIV>=A0 =A0 =A0 =A0 =
</DIV><DIV>=A0 =A0 =A0 =A0 WsdlDefinitions def =3D =
WsdlResolver.getInstance().loadWsdl(base, new URI(wsdlLoc));</DIV><DIV>=A0=
=A0 =A0 =A0 </DIV><DIV>=A0 =A0 =A0 =A0 WSIFServiceFactory wsf =3D =
WSIFServiceFactory.newInstance();</DIV><DIV>=A0 =A0 =A0 =A0 WSIFService =
serv =3D wsf.getService(def);</DIV><DIV>=A0 =A0 =A0 =A0 </DIV><DIV>=A0 =A0=
=A0 =A0 WSIFPort port =3D serv.getPort();</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>=A0 =A0 =A0 =A0 =
</DIV><DIV>=A0 =A0 =A0 =A0 WSIFOperation op =3D =
port.createOperation(opName);</DIV><DIV>=A0 =A0 =A0 =A0 WSIFMessage in =3D=
op.createInputMessage();</DIV><DIV>=A0 =A0 =A0 =A0 WSIFMessage out =3D =
op.createOutputMessage();</DIV><DIV>=A0 =A0 =A0 =A0 WSIFMessage fault =3D =
op.createFaultMessage();</DIV><DIV>=A0 =A0 =A0 =A0 </DIV><DIV>=A0 =A0 =A0 =
=A0 </DIV><DIV>=A0 =A0 =A0 =A0 WsdlBindingOperation wsdlBindingOperation =
=3D=A0 op.getBindingOperation();</DIV><DIV>=A0 =A0 =A0 =A0 =
WsdlPortTypeOperation wsdlPortTypeOperation =3D =
wsdlBindingOperation.lookupOperation();</DIV><DIV>=A0 =A0 =A0 =A0 =
WsdlMessage wsdlInputMessage =3D =
wsdlPortTypeOperation.getInput().lookupMessage();</DIV><DIV>=A0 =A0 =A0 =
=A0 Iterator wsdlMessageParts =3D =
wsdlInputMessage.getParts().iterator();</DIV><DIV>=A0 =A0 =A0 =A0 <SPAN =
class=3D"Apple-tab-span" style=3D"white-space:pre"> =
</SPAN>System.out.println("Following parts were found for this =
message:");</DIV><DIV>=A0 =A0 =A0 =A0 while (wsdlMessageParts.hasNext() =
=3D=3D true) {</DIV><DIV>=A0 =A0 =A0 =A0 <SPAN class=3D"Apple-tab-span" =
style=3D"white-space:pre"> </SPAN>WsdlMessagePart wsdlPart =
=3D (WsdlMessagePart) wsdlMessageParts.next();</DIV><DIV>=A0 =A0 =A0 =A0 =
<SPAN class=3D"Apple-tab-span" style=3D"white-space:pre"> =
</SPAN>System.out.println("- " + wsdlPart.getPartName());</DIV><DIV>=A0 =
=A0 =A0 =A0 }</DIV><DIV>=A0 =A0 =A0 =A0 </DIV><DIV>=A0 =A0 =A0 =A0 =
</DIV><DIV>=A0 =A0 =A0 =A0 XmlElement sarray =3D =
builder.parseFragmentFromReader(new =
StringReader("<GetQuote><symbol>IBM</symbol></GetQuot=
e>"));</DIV><DIV>=A0 =A0 =A0 =A0 </DIV><DIV>=A0 =A0 =A0 =A0 =
in.setObjectPart("parameters",sarray);</DIV><DIV>=A0 =A0 =A0 =A0 =
</DIV><DIV>=A0 =A0 =A0 =A0 boolean succes =3D =
op.executeRequestResponseOperation(in, out, fault);</DIV><DIV>=A0 =A0 =A0 =
=A0 if(succes) {</DIV><DIV>=A0 =A0 =A0 =A0 =A0 =A0 =
System.out.println("received response "+out);</DIV><DIV>=A0 =A0 =A0 =A0 =
} else {</DIV><DIV>=A0 =A0 =A0 =A0 =A0 =A0 System.err.println("received =
fault "+fault);</DIV><DIV>=A0 =A0 =A0 =A0 }</DIV><DIV>=A0 =A0 =
}</DIV><DIV>=A0 =A0 </DIV><DIV>}</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>Console:</DIV><DIV =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; "><FONT class=3D"Apple-style-span" color=3D"#FF0000" =
face=3D"Monaco" size=3D"3"><SPAN class=3D"Apple-style-span" =
style=3D"font-size: 11px;">Starting =
XsulDynamicInvoker_org</SPAN></FONT></DIV><DIV style=3D"margin-top: 0px; =
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT =
class=3D"Apple-style-span" color=3D"#FF0000" face=3D"Monaco" =
size=3D"3"><SPAN class=3D"Apple-style-span" style=3D"font-size: =
11px;">invoking operation 'GetQuote' using WSDL from <A =
href=3D"http://www.webservicex.net/stockquote.asmx?WSDL">http://www.webser=
vicex.net/stockquote.asmx?WSDL</A></SPAN></FONT></DIV><DIV =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; "><FONT class=3D"Apple-style-span" face=3D"Monaco" =
size=3D"3"><SPAN class=3D"Apple-style-span" style=3D"font-size: =
11px;">Following parts were found for this =
message:</SPAN></FONT></DIV><DIV style=3D"margin-top: 0px; margin-right: =
0px; margin-bottom: 0px; margin-left: 0px; "><FONT =
class=3D"Apple-style-span" face=3D"Monaco" size=3D"3"><SPAN =
class=3D"Apple-style-span" style=3D"font-size: 11px;">- =
parameters</SPAN></FONT></DIV><DIV style=3D"margin-top: 0px; =
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT =
class=3D"Apple-style-span" color=3D"#FF0000" face=3D"Monaco" =
size=3D"3"><SPAN class=3D"Apple-style-span" style=3D"font-size: =
11px;">Exception in thread "main" </SPAN></FONT><FONT =
class=3D"Apple-style-span" color=3D"#000080" face=3D"Monaco" =
size=3D"3"><SPAN class=3D"Apple-style-span" style=3D"font-size: 11px; =
text-decoration: underline;">xsul.wsif.WSIFException</SPAN></FONT><FONT =
class=3D"Apple-style-span" color=3D"#FF0000" face=3D"Monaco" =
size=3D"3"><SPAN class=3D"Apple-style-span" style=3D"font-size: 11px;">: =
no part with name 'parameters' is allowed</SPAN></FONT></DIV><DIV =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; "><SPAN class=3D"Apple-tab-span" =
style=3D"white-space:pre"> </SPAN><FONT class=3D"Apple-style-span" =
color=3D"#FF0000" face=3D"Monaco" size=3D"3"><SPAN =
class=3D"Apple-style-span" style=3D"font-size: 11px;">at =
xsul.wsif.impl.WSIFMessageElement.setObjectPart(</SPAN></FONT><FONT =
class=3D"Apple-style-span" color=3D"#000080" face=3D"Monaco" =
size=3D"3"><SPAN class=3D"Apple-style-span" style=3D"font-size: 11px; =
text-decoration: =
underline;">WSIFMessageElement.java:288</SPAN></FONT><FONT =
class=3D"Apple-style-span" color=3D"#FF0000" face=3D"Monaco" =
size=3D"3"><SPAN class=3D"Apple-style-span" style=3D"font-size: =
11px;">)</SPAN></FONT></DIV><DIV style=3D"margin-top: 0px; margin-right: =
0px; margin-bottom: 0px; margin-left: 0px; "><SPAN =
class=3D"Apple-tab-span" style=3D"white-space:pre"> </SPAN><FONT =
class=3D"Apple-style-span" color=3D"#FF0000" face=3D"Monaco" =
size=3D"3"><SPAN class=3D"Apple-style-span" style=3D"font-size: =
11px;">at XsulDynamicInvoker_org.runClient(</SPAN></FONT><FONT =
class=3D"Apple-style-span" color=3D"#000080" face=3D"Monaco" =
size=3D"3"><SPAN class=3D"Apple-style-span" style=3D"font-size: 11px; =
text-decoration: =
underline;">XsulDynamicInvoker_org.java:86</SPAN></FONT><FONT =
class=3D"Apple-style-span" color=3D"#FF0000" face=3D"Monaco" =
size=3D"3"><SPAN class=3D"Apple-style-span" style=3D"font-size: =
11px;">)</SPAN></FONT></DIV><DIV style=3D"margin-top: 0px; margin-right: =
0px; margin-bottom: 0px; margin-left: 0px; "><SPAN =
class=3D"Apple-tab-span" style=3D"white-space:pre"> </SPAN><FONT =
class=3D"Apple-style-span" color=3D"#FF0000" face=3D"Monaco" =
size=3D"3"><SPAN class=3D"Apple-style-span" style=3D"font-size: =
11px;">at XsulDynamicInvoker_org.main(</SPAN></FONT><FONT =
class=3D"Apple-style-span" color=3D"#000080" face=3D"Monaco" =
size=3D"3"><SPAN class=3D"Apple-style-span" style=3D"font-size: 11px; =
text-decoration: =
underline;">XsulDynamicInvoker_org.java:45</SPAN></FONT><FONT =
class=3D"Apple-style-span" color=3D"#FF0000" face=3D"Monaco" =
size=3D"3"><SPAN class=3D"Apple-style-span" style=3D"font-size: =
11px;">)</SPAN></FONT></DIV><DIV style=3D"margin-top: 0px; margin-right: =
0px; margin-bottom: 0px; margin-left: 0px; "><BR =
class=3D"khtml-block-placeholder"></DIV></BODY></HTML>=
--Apple-Mail-1--358212207--