[xgws-user] XSUL Dynamic Invoker Problem with .NET
Andre P.
andre.p.piazza_at_gmail.com
Tue, 7 Nov 2006 16:39:34 -0200
------=_Part_10663_7400791.1162924774231
Content-Type: multipart/alternative;
boundary="----=_Part_10664_32372029.1162924774231"
------=_Part_10664_32372029.1162924774231
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Hello Alek! Sorry for taking so long to reply you, I had some trouble with
my computer!
Well, I inserted your code snippet... :
{
WSIFMessageElement inputMessage =3D ((WSIFMessageElement)in);
XmlNamespace ns =3D inputMessage.getNamespace();
inputMessage.addElement(ns, "item").addChild("keyboard");
}
... and the things worked fine now with my service.
But it's not Dynamic (and WSD independent) anymore, isn't it? Because my
code is now specific to my getPrice webservice, if I use another WSDL, it's
not going to work right? The "keyboard" part it's ok, I can substitute with
args[2], but the "item" is a specific thing from my WSDL and cannot be used
in another service (which will have another input message).
Still on the WSDL, I totally agree with you about the optional input messag=
e
(doesn't make any sense to me either!), but the strange thing is that the
WSDL was automatically generated by .NET framework when I attach a ?WSDL in
the end of the endpoint: http://localhost/GetPrice/Service.asmx. I'm
attaching (as a file now :) ) my .cs code for the .NET WService that
generates that WSDL for you to take a look and see if something is wrong!
Thanks again for your useful help!
Best regards,
Andre
On 10/31/06, Aleksander Slominski <aslom_at_cs.indiana.edu> wrote:
>
> hi Andre,
>
> please when you send WSDL to use for testing send it as attachment - i
> had to do plenty of editing to get working WSDL to reproduce the problem.
>
> more below.
>
> Andr=E9 Piazza wrote:
> > Hello list!
> >
> > I got the latest xsul library(2.7.9), and everything is working fine
> > when dynamic invoking some web services (deployed in axis, phpnusoap,
> > websphere), except for the document/literal wrapped .NET Web Services.
> >
> > With the logging utility enabled, I can see that the SOAP envelope is
> > not sending the parameters correctly when the service is in .NET!
> >
> > My args are http://localhost/GetPrice/Service.asmx?WSDL getPrice
> > keyboard
> >
> > The envelope is incorrect (in bold), the value of "item" is not
> > included (should be <item>keyboard</item> isn't it?).
> your schema has elementFormDefault =3D"*qualified*" so item has to be in
> schema namespace as it is
> > I'm also attaching the .wsdl of the .NET service, and the .java of
> > xsul dynamic invoker (without the selftest and stuff).
> your input message (getPriceSoapIn) is <item> and you have it optional
> (?!) - that is what is sent when getPrice operation is used - it does
> not really make sense to me .as it is generally required to have _some_
> input message - i have seen empty input and return message but still
> there was some message and never optional ...
>
> instead i think you should define getPrice element and have optional
> item inside - see attached WSDL to see it.
>
> the input parameter is optional so it can not be set by
> XsulDynamicInvoker (DII is really simple command line tester to show API
> but more sophisticated command line options would be required to support
> XML as input, optional parameters etc) still you can force setting it by
> adding right element to input message - for example (you could modify
> command line parsing logic to support name=3Dvalue to set it):
>
> {
> WSIFMessageElement inputMessage =3D ((WSIFMessageElement)in);
> XmlNamespace ns =3D inputMessage.getNamespace(); // it is
> qualified - children element must have namespace
> inputMessage.addElement(ns, "item").addChild("keyboard");
> }
>
> best,
>
> alek
>
> ps. here is modified DII i used and below is output
>
> /* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*-
> //------100-columns-wide------>|*/
> /*
> * Copyright (c) 2005 Extreme! Lab, Indiana University. All rights
> reserved.
> *
> * This software is open source. See the bottom of this file for the
> licence.
> *
> * $Id: XsulDynamicInvoker.java,v 1.5 2006/05/24 06:50:10 aslom Exp $
> */
>
> package xsul.dii;
>
> import java.io.File;
> import java.net.URI;
> import java.util.Iterator;
> import java.util.List;
> import javax.xml.namespace.QName;
> import org.xmlpull.v1.builder.XmlElement;
> import org.xmlpull.v1.builder.XmlInfosetBuilder;
> import org.xmlpull.v1.builder.XmlNamespace;
> import xsul.MLogger;
> import xsul.XmlConstants;
> import xsul.wsdl.WsdlBindingOperation;
> import xsul.wsdl.WsdlDefinitions;
> import xsul.wsdl.WsdlMessage;
> 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.impl.WSIFMessageElement;
> import xsul.wsif.spi.WSIFProviderManager;
>
> public class XsulDynamicInvoker {
> private final static MLogger logger =3D MLogger.getLogger();
> private final static XmlInfosetBuilder builder =3D XmlConstants.BUILD=
ER;
>
> private static void usage(String errMsg) {
> System.err.println("Usage: {WSDL URL} {operation name}
> [parameters ...]");
> }
>
> public static void main(String[] args) throws Exception
> {
> System.err.println("Starting
> "+XsulDynamicInvoker.class.getName());
> WSIFProviderManager.getInstance().addProvider( new
> xsul.wsif_xsul_soap_http.Provider() );
>
> if(args.length > 0 && args[0].equals("selftest")) {
> String GOOGLE_KEY =3D "google.key";
> String googleKey =3D System.getProperty(GOOGLE_KEY); //
> if(googleKey !=3D null) {
> runClient(new String[]{
> "http://api.google.com/GoogleSearch.wsdl",
> "doGoogleSearch", googleKey, "alek",
> "0", "10", "false", "", "false", "",
> "latin1", "latin1"});
> } else {
> System.err.println("Warning: pass your your google api
> key as -D"+GOOGLE_KEY+"=3DXXXXXX");
> }
>
> //2005-01-17 error 200 OK body=3D"" Content-Type: text/html
> //runClient(new String[]{
> // "http://www.ghettodriveby.com/soap/?wsdl",
> "getRandomGoogleSearch", "aleksander slominksi"});
>
>
> runClient(new String[]{
>
> "http://www.xmethods.net/sd/2001/BabelFishService.wsdl", "BabelFish",
> "en_fr", "I'm going to the beach."});
> runClient(new String[]{
>
> "http://www.webservicex.net/ValidateEmail.asmx?wsdl", "IsValidEMail",
> "aleksander_at_example.com"});
>
> runClient(new String[]{
>
> "http://www.xmethods.net/sd/2001/TemperatureService.wsdl", "getTemp",
> "02067"});
> // java.io.IOException: Server returned HTTP response code:
> 502 for URL:
> http://services.xmethods.net/soap/urn:xmethods-delayed-quotes.wsdl
> // runClient(new String[]{
> //
> "http://services.xmethods.net/soap/urn:xmethods-delayed-quotes.wsdl",
> // "getQuote", "IBM"});
> runClient(new String[]{
>
> "http://mssoapinterop.org/asmx/xsd/round4XSD.wsdl", "echoString", "Hello
> World!!!"});
> runClient(new String[]{
>
> "
> http://samples.gotdotnet.com/quickstart/aspplus/samples/services/MathServ=
ice/VB/MathService.asmx?WSDL
> ",
> "Add", "3", "4"});
> runClient(new String[]{ //sometimes timeout
>
> "http://www.webservicex.net/stockquote.asmx?WSDL", "GetQuote", "IBM"});
> // runClient(new String[]{ //FAILING - cant find
> WSDL
> //
> "http://developerdays.com/cgi-bin/tempconverter.exe/wsdl/ITempConverter",
> "CtoF", "32"});
> runClient(new String[]{
> "http://www.webservicex.net/icd10.asmx?WSDL",
> "GetICD10", "foo"});
> //simple http://www.ghettodriveby.com/soap/?wsdl
> //wsdl:import test
> http://eutils.ncbi.nlm.nih.gov/entrez/eutils/soap/eutils.wsdl
> runClient(new String[]{
>
> "http://ws.netviagens.com/webservices/AirFares.asmx?wsdl", "GetFares",
> "", "JFK", "WAW", "2005-01-20", "2005-02-02"
> });
> } else {
> runClient(args);
> }
> }
>
> private static void runClient(String[] args) throws Exception {
> //args[0] =3D
> URI base =3D ((new File(".")).toURI());
>
> if(args.length < 2) {
> usage("at least two argument required");
> }
>
> String wsdlLoc =3D args[0];
> //System.out.println("loaded def=3D"+def);
>
> String opName =3D args[1];
> String portName =3D null;
> if(opName.charAt(0) =3D=3D '{') {
> int pos =3D opName.indexOf('}');
> portName =3D opName.substring(1, pos);
> opName =3D opName.substring(pos+1);
> }
>
> //System.out.println("invoking Google WS with query '"+query+"'
> using WSDL from "+wsdlLoc);
> System.err.println("invoking operation '"+opName+"' using WSDL
> from "+wsdlLoc);
>
> //MLogger.setCmdNames(":ALL");
> WsdlDefinitions def =3D WsdlResolver.getInstance().loadWsdl(base,
> new URI(wsdlLoc));
>
> WSIFServiceFactory wsf =3D WSIFServiceFactory.newInstance();
> WSIFService serv =3D wsf.getService(def);
>
> WSIFPort port =3D serv.getPort(portName);
>
> WSIFOperation op =3D port.createOperation(opName);
> WSIFMessage in =3D op.createInputMessage();
>
>
> WsdlBindingOperation bindingOp =3D op.getBindingOperation();
> WsdlPortTypeOperation portTypeOp =3D bindingOp.lookupOperation();
> WsdlMessage inputMsg =3D portTypeOp.getInput().lookupMessage();
> Iterator partNames =3D in.partNames().iterator();
>
> //WSDL URL =3D - =3D=3D> read from stdin
> //allow arguments:
> //1. [position=3D]value only allowed as first arguments if
> position not specified (this is POSITIONAL!)
> // position 1...
> //2. name=3Dvalue
> //4. [name]=3D<xml>value
> //
>
> //-Depr=3D- =3D=3D> read from stdin
> //-Dselect=3D"XPATH filter"
>
> //process arguments
> // deal with stupid element=3D wrapping and other stuff (special
> case for one part hat is element) ...
>
>
> // for (int i =3D 2; i < args.length; i++) {
> // //determine type of argument
> // String partName =3D (String) partNames.next();
> //partNames.get(i-2);
> // String partValue =3D args[i];
> // System.err.println(partName+"=3D"+partValue);
> // in.setObjectPart(partName, partValue);
> // }
>
> int count =3D 2;
> while(partNames.hasNext()) {
> //determine type of argument
> String partName =3D (String) partNames.next();
> //partNames.get(i-2);
> if(count < args.length) {
> String partValue =3D args[count];
> System.err.println(partName+"=3D"+partValue);
> in.setObjectPart(partName, partValue);
> } else {
> // will try to do some defaulting
> QName type =3D
> ((WSIFMessageElement)in).getPartType(partName);
>
> String localPart =3D type.getLocalPart();
> if("string".equals(localPart)) {
> String DEFAULT_STRING =3D "foo string";
> in.setObjectPart(partName, DEFAULT_STRING);
> System.err.println("defaulting
> "+partName+"=3D"+in.getObjectPart(partName));
> } else if("anyURI".equals(localPart)) {
> String DEFAULT_URI =3D "gsiftp://rainier//tmp/foo.txt=
";
> in.setObjectPart(partName, DEFAULT_URI);
> System.err.println("defaulting
> "+partName+"=3D"+in.getObjectPart(partName));
> } else if("URIArrayType".equals(localPart)) {
> XmlElement arrayEl =3D builder.newFragment(partName);
> String DEFAULT_URI_ARRAY_ITEM =3D
> "gsiftp://rainier//tmp/foo.txt";
>
> arrayEl.addElement("value").addChild(DEFAULT_URI_ARRAY_ITEM);
> in.setObjectPart(partName, arrayEl);
> System.err.println("defaulting
> "+partName+"=3D"+in.getObjectPart(partName));
> }
> }
>
> ++count;
> }
>
> {
> WSIFMessageElement inputMessage =3D ((WSIFMessageElement)in);
> XmlNamespace ns =3D inputMessage.getNamespace(); // it is
> qualified - children element must have namespace
> inputMessage.addElement(ns, "item").addChild("keyboard");
> }
> // in.setObjectPart("key", key);
> // in.setObjectPart("q", query);
> // in.setObjectPart("start", "0");
> // in.setObjectPart("maxResults", "10");
> // in.setObjectPart("filter", "true");
> // //restrict xsi:type=3D"xsd:string"
> // in.setObjectPart("safeSearch", "false");
> // //lr xsi:type=3D"xsd:string"
> // in.setObjectPart("ie", "latin1");
> // in.setObjectPart("oe","latin1");
> if(op.isRequestResponseOperation()) {
> WSIFMessage out =3D op.createOutputMessage();
> WSIFMessage fault =3D op.createFaultMessage();
> boolean succes =3D op.executeRequestResponseOperation(in, out=
,
> fault);
> if(succes) {
> System.err.println("received response "+out);
> } else {
> System.err.println("received fault "+fault);
> }
> } else {
> op.executeInputOnlyOperation(in);
> System.out.println("input only message was sent
> successfully");
> }
> }
>
> private static void addListOfElementNames(XmlElement sequenceEl,
> List partNames) {
> for(Iterator ei =3D
> sequenceEl.requiredElementContent().iterator(); ei.hasNext(); ) {
> XmlElement xsdSomething =3D (XmlElement) ei.next();
> if(! xsdSomething.getName().equals("element")) {
> throw new WSIFException("only xsd:element is supported
> in xsd:sequence");
> }
> String name =3D xsdSomething.getAttributeValue(null, "name");
> logger.fine("adding sequence element name=3D"+name);
> partNames.add(name);
> }
>
> }
>
>
> }
>
> /*
> * Indiana University Extreme! Lab Software License, Version 1.2
> *
> * Copyright (c) 2002-2005 The Trustees of Indiana University.
> * All rights reserved.
> *
> * Redistribution and use in source and binary forms, with or without
> * modification, are permitted provided that the following conditions are
> * met:
> *
> * 1) All redistributions of source code must retain the above
> * copyright notice, the list of authors in the original source
> * code, this list of conditions and the disclaimer listed in this
> * license;
> *
> * 2) All redistributions in binary form must reproduce the above
> * copyright notice, this list of conditions and the disclaimer
> * listed in this license in the documentation and/or other
> * materials provided with the distribution;
> *
> * 3) Any documentation included with all redistributions must include
> * the following acknowledgement:
> *
> * "This product includes software developed by the Indiana
> * University Extreme! Lab. For further information please visit
> * http://www.extreme.indiana.edu/"
> *
> * Alternatively, this acknowledgment may appear in the software
> * itself, and wherever such third-party acknowledgments normally
> * appear.
> *
> * 4) The name "Indiana University" or "Indiana University
> * Extreme! Lab" shall not be used to endorse or promote
> * products derived from this software without prior written
> * permission from Indiana University. For written permission,
> * please contact http://www.extreme.indiana.edu/.
> *
> * 5) Products derived from this software may not use "Indiana
> * University" name nor may "Indiana University" appear in their name,
> * without prior written permission of the Indiana University.
> *
> * Indiana University provides no reassurances that the source code
> * provided does not infringe the patent or any other intellectual
> * property rights of any other entity. Indiana University disclaims any
> * liability to any recipient for claims brought by any other entity
> * based on infringement of intellectual property rights or otherwise.
> *
> * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH
> * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA
> * UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT
> * SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR
> * OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT
> * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP
> * DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE
> * RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS,
> * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING
> * SOFTWARE.
> */
>
> java -Dlog xsul.dii.XsulDynamicInvoker "!MISC/andre/GetPrice.wsdl"
> getPrice keyboard
> MLogger $Revision: 1.8 $ $Date: 2005/02/16 05:52:51 $ (GMT) configured
> as '' (XSUL version compile-time:2.7.9 runtime:2.7.9)
> Starting xsul.dii.XsulDynamicInvoker
> invoking operation 'getPrice' using WSDL from !MISC/andre/GetPrice.wsdl
> [ 18:52:58.769 main: xsul.wsif.impl.WSIFMessageElement.java:88
> addPlaceholderForParameters 5]
> elementPartQName=3D{http://tempuri.org/}getPrice
> [ 18:52:58.920 main: xsul.wsif.impl.WSIFMessageElement.java:184
> addPlaceholderForParameters 5] special messageIn=3D<n1:getPrice
> xmlns:n1=3D"http://tempuri.org/" />
> [ 18:52:58.920 main: xsul.wsif.impl.WSIFMessageElement.java:195
> addPlaceholderForParameters 5] messageIn=3D<n1:getPrice
> xmlns:n1=3D"http://tempuri.org/" />
> [ 18:52:58.940 main: xsul.wsif.impl.WSIFMessageElement.java:88
> addPlaceholderForParameters 5]
> elementPartQName=3D{http://tempuri.org/}getPriceResult
> [ 18:52:58.940 main: xsul.wsif.impl.WSIFMessageElement.java:245
> addListOfElementNames 3] adding sequence element type
> name=3DgetPriceResult typeQName=3D{http://www.w3.org/2001/XMLSchema}doubl=
e
> [ 18:52:58.940 main: xsul.wsif.impl.WSIFMessageElement.java:252
> addListOfElementNames 3] adding sequence element name=3DgetPriceResult
> [ 18:52:58.940 main: xsul.wsif.impl.WSIFMessageElement.java:177
> addPlaceholderForParameters 1] name=3DgetPriceResult
> [ 18:52:58.940 main: xsul.wsif.impl.WSIFMessageElement.java:184
> addPlaceholderForParameters 5] special messageIn=3D<n1:getPriceResult
> xmlns:n1=3D"http://tempuri.org/"><n1:getPriceResult /></n1:getPriceResult=
>
> [ 18:52:58.950 main: xsul.wsif.impl.WSIFMessageElement.java:195
> addPlaceholderForParameters 5] messageIn=3D<n1:getPriceResult
> xmlns:n1=3D"http://tempuri.org/"><n1:getPriceResult /></n1:getPriceResult=
>
> [ 18:52:58.960 main:
> xsul.invoker.http.HttpDynamicInfosetInvoker.java:248 invokeXml 1]
> host=3Dlocalhost port=3D80 secure=3Dfalse
> [ 18:52:58.960 main:
> xsul.http_client.plain_impl.PlainClientSocketFactory.java:45 connect 1]
> connect localhost:80 timeout:240000
> [ 18:52:59.250 main: trace.xsul.http.client.out
> xsul.http_client.HttpClientRequest.java:244 writeHeaders 1] TRACE:
> sending request headers:---
> POST /GetPrice/Service.asmx HTTP/1.0\r
> Host: localhost\r
> User-Agent: XSUL/2.7.9\r
> Content-Type: text/xml; charset=3Dutf-8\r
> Content-Length: 563\r
> Keep-Alive: 300\r
> SOAPAction: \"http://tempuri.org/getPrice\"\r
> Connection: keep-alive\r
> \r
> ---
>
> [ 18:52:59.280 main: trace.xsul.http.client.out
> xsul.http_client.HttpClientRequest.java:284 closeRequest 1] TRACE:
> sending request body:---
> <?xml version=3D'1.0' encoding=3D'utf-8'?><S:Envelope
> xmlns:xsd=3D'http://www.w3.org/2001/XMLSchema'
> xmlns:xsi=3D'http://www.w3.org/2001/XMLSchema-instance'
> xmlns:wsa=3D'http://www.w3.org/2005/08/addressing'
> xmlns:wsp=3D'http://schemas.xmlsoap.org/ws/2002/12/policy'
> xmlns:S=3D'http://schemas.xmlsoap.org/soap/envelope/'><S:Header><wsa:To>
> http://localhost/GetPrice/Service.asmx</wsa:To><wsa:Action>
> http://tempuri.org//ServiceSoap/getPrice
> </wsa:Action></S:Header><S:Body><n1:getPrice
> xmlns:n1=3D'http://tempuri.org/'
> ><n1:item>keyboard</n1:item></n1:getPrice></S:Body></S:Envelope>---
>
> >
> > Thanks in advance for any help!
> >
> > Best regards,
> >
> > Andre
> >
> >
> > ############### ENVELOPE ################
> > <?xml version=3D'1.0' encoding=3D'utf-8'?>
> > <S:Envelope xmlns:xsd=3D' http://www.w3.org/2001/XMLSchema' xmlns:xsi=
=3D'
> > http://www.w3.org/2001/XMLSchema-instance' xmlns:wsa=3D'
> > http://www.w3.org/2005/08/addressing'
> > xmlns:wsp=3D'http://schemas.xmlsoap.org/ws/2002/12/policy
> > <http://schemas.xmlsoap.org/ws/2002/12/policy>'
> > xmlns:S=3D'http://schemas.xmlsoap.org/soap/envelope/'
> > <http://schemas.xmlsoap.org/soap/envelope/%27>>
> > <S:Header>
> > <wsa:To>http://localhost/GetPrice/Service.asmx</wsa:To>
> > <wsa:Action> http://tempuri.org//ServiceSoap/getPrice</wsa:Action>
> > </S:Header>
> > <S:Body>
> > <n1:item xmlns:n1=3D' http://tempuri.org/' />
> > </S:Body>
> > </S:Envelope>
> >
> >
> >
> > ############### WSDL ################
> > <?xml version=3D"1.0" encoding=3D"utf-8" ?>
> > - <#> <wsdl:definitions xmlns:soap
> > =3D"*http://schemas.xmlsoap.org/wsdl/soap/*" xmlns:tm=3D"
> > *http://microsoft.com/wsdl/mime/textMatching/*" xmlns:soapenc=3D"
> > *http://schemas.xmlsoap.org/soap/encoding/*" xmlns:mime=3D"*
> > http://schemas.xmlsoap.org/wsdl/mime/*" xmlns:tns=3D"*
> > http://tempuri.org/*" xmlns:s=3D"*http://www.w3.org/2001/XMLSchema*"
> > xmlns:soap12 =3D"*http://schemas.xmlsoap.org/wsdl/soap12/*"
> > xmlns:http=3D"* http://schemas.xmlsoap.org/wsdl/http/*"
> > targetNamespace=3D"* http://tempuri.org/*"
> > xmlns:wsdl=3D"*http://schemas.xmlsoap.org/wsdl/*">
> > - <#> <wsdl:types>
> > - <#> <s:schema elementFormDefault =3D"*qualified*"
> > targetNamespace=3D"*http://tempuri.org/*">
> > - <#> <s:element name =3D"*item*">
> > - <#> <s:complexType>
> > - <#> <s:sequence>
> > <s:element minOccurs=3D"*0* " maxOccurs=3D"*1*" name=3D"*item*"
> > type=3D"*s:string*" />
> > </s:sequence>
> > </s:complexType>
> > </s:element>
> > - <#> <s:element name =3D"*getPriceResponse*">
> > - <#> <s:complexType>
> > - <#> <s:sequence>
> > <s:element minOccurs=3D"*1* " maxOccurs=3D"*1*" name=3D"*getPriceResu=
lt*"
> > type=3D"*s:double*" />
> > </s:sequence>
> > </s:complexType>
> > </s:element>
> > </s:schema>
> > </wsdl:types>
> > - <#> <wsdl:message name =3D"*getPriceSoapIn*">
> > <wsdl:part name=3D"*parameters* " element=3D"*tns:item*" />
> > </wsdl:message>
> > - <#> <wsdl:message name =3D"*getPriceSoapOut*">
> > <wsdl:part name=3D"*parameters* " element=3D"*tns:getPriceResponse*" =
/>
> > </wsdl:message>
> > - <#> <wsdl:portType name =3D"*ServiceSoap*">
> > + <#> <wsdl:operation name =3D"*getPrice*">
> > <wsdl:input message=3D"*tns:getPriceSoapIn* " />
> > <wsdl:output message=3D"*tns:getPriceSoapOut* " />
> > </wsdl:operation>
> > </wsdl:portType>
> > - <#> <wsdl:binding name =3D"*ServiceSoap*" type=3D"*tns:ServiceSoap*">
> > <soap:binding transport=3D"* http://schemas.xmlsoap.org/soap/http*" /=
>
> > - <#> <wsdl:operation name =3D"*getPrice*">
> > <soap:operation soapAction=3D"* http://tempuri.org/getPrice*"
> > style=3D"*document*" />
> > - <#> <wsdl:input>
> > <soap:body use=3D"*literal* " />
> > </wsdl:input>
> > - <#> <wsdl:output>
> > <soap:body use=3D"*literal* " />
> > </wsdl:output>
> > </wsdl:operation>
> > </wsdl:binding>
> > - <#> <wsdl:binding name =3D"*ServiceSoap12*" type=3D"*tns:ServiceSoap*=
">
> > <soap12:binding transport=3D"* http://schemas.xmlsoap.org/soap/http*"=
/>
> > - <#> <wsdl:operation name =3D"*getPrice*">
> > <soap12:operation soapAction=3D"* http://tempuri.org/getPrice*"
> > style=3D"*document*" />
> > - <#> <wsdl:input>
> > <soap12:body use=3D"*literal* " />
> > </wsdl:input>
> > - <#> <wsdl:output>
> > <soap12:body use=3D"*literal* " />
> > </wsdl:output>
> > </wsdl:operation>
> > </wsdl:binding>
> > - <#> <wsdl:service name =3D"*Service*">
> > - <#> <wsdl:port name =3D"*ServiceSoap*" binding=3D"*tns:ServiceSoap*">
> > <soap:address location=3D"* http://localhost/GetPrice/Service.asmx*" =
/>
> > </wsdl:port>
> > - <#> <wsdl:port name =3D"*ServiceSoap12*" binding=3D"*tns:ServiceSoap1=
2*">
> > <soap12:address location=3D"* http://localhost/GetPrice/Service.asmx*=
"
> />
> > </wsdl:port>
> > </wsdl:service>
> > </wsdl:definitions>
> >
> >
> >
> >
> >
> >
> > ######################## JAVA #########################
> >
> > import java.io.File ;
> > import java.net.URI;
> > import java.util.Iterator;
> > import java.util.List;
> > import javax.xml.namespace.QName;
> > 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.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.impl.WSIFMessageElement ;
> > import xsul.wsif.spi.WSIFProviderManager;
> >
> > public class XsulDynamicInvoker {
> > private final static MLogger logger =3D MLogger.getLogger();
> > private final static XmlInfosetBuilder builder =3D
> > XmlConstants.BUILDER ;
> >
> > private static void usage(String errMsg) {
> > System.err.println("Usage: {WSDL URL} {operation name}
> > [parameters ...]");
> > }
> >
> > public static void main(String[] args) throws Exception
> > {
> > System.err.println("Starting
> > "+XsulDynamicInvoker.class.getName());
> > WSIFProviderManager.getInstance().addProvider( new
> > xsul.wsif_xsul_soap_http.Provider() );
> > runClient(args);
> > }
> >
> > private static void runClient(String[] args) throws Exception {
> > URI base =3D ((new File(".")).toURI());
> >
> > if(args.length < 2) {
> > usage("at least two argument required");
> > }
> >
> > String wsdlLoc =3D args[0];
> >
> > String opName =3D args[1];
> > String portName =3D null;
> > if(opName.charAt(0) =3D=3D '{') {
> > int pos =3D opName.indexOf('}');
> > portName =3D opName.substring(1, pos);
> > opName =3D opName.substring(pos+1);
> > }
> >
> > System.err.println("invoking operation '"+opName+"' using WSDL
> > from "+wsdlLoc);
> > //log everything!
> > MLogger.setCmdNames(":ALL");
> > WsdlDefinitions def =3D
> > WsdlResolver.getInstance().loadWsdl(base, new URI(wsdlLoc));
> >
> > WSIFServiceFactory wsf =3D WSIFServiceFactory.newInstance();
> > WSIFService serv =3D wsf.getService(def);
> >
> > WSIFPort port =3D serv.getPort(portName);
> >
> > WSIFOperation op =3D port.createOperation(opName);
> > WSIFMessage in =3D op.createInputMessage();
> >
> > WsdlBindingOperation bindingOp =3D op.getBindingOperation();
> > WsdlPortTypeOperation portTypeOp =3D bindingOp.lookupOperation(=
);
> > WsdlMessage inputMsg =3D portTypeOp.getInput().lookupMessage();
> > Iterator partNames =3D in.partNames().iterator();
> >
> > int count =3D 2;
> > while(partNames.hasNext()) {
> > //determine type of argument
> > String partName =3D (String) partNames.next ();
> > //partNames.get(i-2);
> > if(count < args.length) {
> > String partValue =3D args[count];
> > System.err.println(partName+"=3D"+partValue);
> > in.setObjectPart (partName, partValue);
> > } else {
> > // will try to do some defaulting
> > QName type =3D
> > ((WSIFMessageElement)in).getPartType(partName);
> >
> > String localPart =3D type.getLocalPart();
> > if("string".equals(localPart)) {
> > in.setObjectPart(partName, "foo string");
> > System.err.println("defaulting
> > "+partName+"=3D"+in.getObjectPart(partName));
> > } else if("anyURI".equals(localPart)) {
> > in.setObjectPart(partName,
> > "gsiftp://rainier//tmp/foo.txt");
> > System.err.println("defaulting
> > "+partName+"=3D"+in.getObjectPart(partName));
> > } else if("URIArrayType".equals(localPart)) {
> > XmlElement arrayEl =3D builder.newFragment(partName=
);
> >
> > arrayEl.addElement("value").addChild("gsiftp://rainier//tmp/foo.txt");
> > in.setObjectPart(partName, arrayEl);
> > System.err.println("defaulting
> > "+partName+"=3D"+in.getObjectPart(partName));
> > }
> > }
> > ++count;
> > }
> >
> > if(op.isRequestResponseOperation()) {
> > WSIFMessage out =3D op.createOutputMessage();
> > WSIFMessage fault =3D op.createFaultMessage();
> > boolean succes =3D op.executeRequestResponseOperation(in,
> > out, fault);
> > if(succes) {
> > System.out.println("received response "+out);
> > } else {
> > System.err.println("received fault "+fault);
> > }
> > } else {
> > op.executeInputOnlyOperation(in);
> > System.out.println("input only message was sent
> > successfully");
> > }
> > }
> > }
> >
>
>
> --
> The best way to predict the future is to invent it - Alan Kay
>
>
>
>
------=_Part_10664_32372029.1162924774231
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Hello Alek! Sorry for taking so long to reply you, I had some trouble with =
my computer!<br>Well, I inserted your code snippet... :<br> {<br> &nbs=
p; WSIFMessageElement inputMessage =3D ((=
WSIFMessageElement)in);<br> XmlNam=
espace ns =3D=20
inputMessage.getNamespace();<br> i=
nputMessage.addElement(ns, "item").addChild("keyboard")=
;<br>}<br><br>... and the things worked fine now with my service.<br>But it=
's not Dynamic (and WSD independent) anymore, isn't it? Because my code is =
now specific to my getPrice webservice, if I use another WSDL, it's not goi=
ng to work right? The "keyboard" part it's ok, I can substitute w=
ith args[2], but the "item" is a specific thing from my WSDL and =
cannot be used in another service (which will have another input message).
<br><br><br>Still on the WSDL, I totally agree with you about the optional =
input message (doesn't make any sense to me either!), but the strange thing=
is that the WSDL was automatically generated by .NET framework when I atta=
ch a ?WSDL in the end of the endpoint:=20
<a href=3D"http://localhost/GetPrice/Service.asmx">http://localhost/GetPric=
e/Service.asmx</a>. I'm attaching (as a file now :) ) my .cs code for the .=
NET WService that generates that WSDL for you to take a look and see if som=
ething is wrong!
<br><br>Thanks again for your useful help!<br><br>Best regards,<br><br>Andr=
e<br><br><br><br><div><span class=3D"gmail_quote">On 10/31/06, <b class=3D"=
gmail_sendername">Aleksander Slominski</b> <<a href=3D"mailto:aslom_at_cs.i=
ndiana.edu">
aslom_at_cs.indiana.edu</a>> wrote:</span><blockquote class=3D"gmail_quote"=
style=3D"border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.=
8ex; padding-left: 1ex;">hi Andre,<br><br>please when you send WSDL to use =
for testing send it as attachment - i
<br>had to do plenty of editing to get working WSDL to reproduce the proble=
m.<br><br>more below.<br><br>Andr=E9 Piazza wrote:<br>> Hello list!<br>&=
gt;<br>> I got the latest xsul library(2.7.9), and everything is working=
fine
<br>> when dynamic invoking some web services (deployed in axis, phpnuso=
ap,<br>> websphere), except for the document/literal wrapped .NET Web Se=
rvices.<br>><br>> With the logging utility enabled, I can see that th=
e SOAP envelope is
<br>> not sending the parameters correctly when the service is in .NET!<=
br>><br>> My args are <a href=3D"http://localhost/GetPrice/Service.as=
mx?WSDL">http://localhost/GetPrice/Service.asmx?WSDL</a> getPric=
e<br>> keyboard
<br>><br>> The envelope is incorrect (in bold), the value of "it=
em" is not<br>> included (should be <item>keyboard</item&g=
t; isn't it?).<br>your schema has elementFormDefault =3D"*qualified*&q=
uot; so item has to be in
<br>schema namespace as it is<br>> I'm also attaching the .wsdl of the .=
NET service, and the .java of<br>> xsul dynamic invoker (without the sel=
ftest and stuff).<br>your input message (getPriceSoapIn) is <item> an=
d you have it optional
<br>(?!) - that is what is sent when getPrice operation is used - it does<b=
r>not really make sense to me .as it is generally required to have _some_<b=
r>input message - i have seen empty input and return message but still<br>
there was some message and never optional ...<br><br>instead i think you sh=
ould define getPrice element and have optional<br>item inside - =
see attached WSDL to see it.<br><br>the input parameter is optional so it c=
an not be set by
<br>XsulDynamicInvoker (DII is really simple command line tester to show AP=
I<br>but more sophisticated command line options would be required to suppo=
rt<br>XML as input, optional parameters etc) still you can force setting it=
by
<br>adding right element to input message - for example (you could modify<b=
r>command line parsing logic to support name=3Dvalue to set it):<br><br>&nb=
sp; {<br> &=
nbsp; WSIFMessageElement inputMess=
age =3D ((WSIFMessageElement)in);
<br>  =
;XmlNamespace ns =3D inputMessage.getNamespace(); // it is<br>qualified - c=
hildren element must have namespace<br> =
inputMessage.addElement(ns, "item&=
quot;).addChild("keyboard");<br> &nb=
sp; }
<br><br>best,<br><br>alek<br><br>ps. here is modified DII i used and below =
is output<br><br>/* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: ni=
l; -*-<br>//------100-columns-wide------>|*/<br>/*<br> * Copyright (c) 2=
005 Extreme! Lab, Indiana University. All rights reserved.
<br> *<br> * This software is open source. See the bottom of this file for =
the<br>licence.<br> *<br> * $Id: XsulDynamicInvoker.java,v 1.5 2006/05/24 0=
6:50:10 aslom Exp $<br> */<br><br>package xsul.dii;<br><br>import java.io.F=
ile
;<br>import java.net.URI;<br>import java.util.Iterator;<br>import java.util=
.List;<br>import javax.xml.namespace.QName;<br>import org.xmlpull.v1.builde=
r.XmlElement;<br>import org.xmlpull.v1.builder.XmlInfosetBuilder;<br>import=
=20
org.xmlpull.v1.builder.XmlNamespace;<br>import xsul.MLogger;<br>import xsul=
.XmlConstants;<br>import xsul.wsdl.WsdlBindingOperation;<br>import xsul.wsd=
l.WsdlDefinitions;<br>import xsul.wsdl.WsdlMessage;<br>import xsul.wsdl.Wsd=
lPortTypeOperation
;<br>import xsul.wsdl.WsdlResolver;<br>import xsul.wsif.WSIFException;<br>i=
mport xsul.wsif.WSIFMessage;<br>import xsul.wsif.WSIFOperation;<br>import x=
sul.wsif.WSIFPort;<br>import xsul.wsif.WSIFService;<br>import xsul.wsif.WSI=
FServiceFactory
;<br>import xsul.wsif.impl.WSIFMessageElement;<br>import xsul.wsif.spi.WSIF=
ProviderManager;<br><br>public class XsulDynamicInvoker {<br> &n=
bsp; private final static MLogger logger =3D MLogger.getLogger();<br>&=
nbsp; private final static XmlInfosetBuilder builder =3D=
=20
XmlConstants.BUILDER;<br><br> private static void us=
age(String errMsg) {<br> Sys=
tem.err.println("Usage: {WSDL URL} {operation name}<br>[parameters ...=
]");<br> }<br><br> publi=
c static void main(String[] args) throws Exception
<br> {<br> =
System.err.println("Starting "+XsulDynamicInvoker.class.get=
Name());<br> WSIFProviderMan=
ager.getInstance().addProvider( new<br>xsul.wsif_xsul_soap_http.Provider() =
);<br><br> if(
args.length > 0 && args[0].equals("selftest")) {<br>&n=
bsp; Strin=
g GOOGLE_KEY =3D "google.key";<br> &=
nbsp; String googleKey =3D System.getPro=
perty(GOOGLE_KEY); //<br> &nb=
sp; if(googleKey !=3D null) {
<br>  =
; runClient(new String[]{<br>  =
; &n=
bsp; "=
;<a href=3D"http://api.google.com/GoogleSearch.wsdl">http://api.google.com/=
GoogleSearch.wsdl</a>",<br> &=
nbsp; &nbs=
p; &=
quot;doGoogleSearch", googleKey, "alek",
<br>  =
; &n=
bsp; "0", "10"=
, "false", "", "false", "",<br>&quo=
t;latin1", "latin1"});<br> &nbs=
p; } else {<br> &=
nbsp;
System.err.println("Warning: pass your your google api<br>key as -D&qu=
ot;+GOOGLE_KEY+"=3DXXXXXX");<br> &nb=
sp; }<br><br> &nb=
sp; //2005-01-17 error 200 OK body=
=3D"" Content-Type: text/html<br> &n=
bsp; //runClient(new String[]{
<br>  =
;// =
"<a href=3D"http://www.ghettodriveby.com/soap/?wsdl">http://www.ghetto=
driveby.com/soap/?wsdl</a>",<br>"getRandomGoogleSearch", &qu=
ot;aleksander slominksi"});<br><br><br>
run=
Client(new String[]{<br><br>"<a href=3D"http://www.xmethods.net/sd/200=
1/BabelFishService.wsdl">http://www.xmethods.net/sd/2001/BabelFishService.w=
sdl</a>", "BabelFish",<br> &nbs=
p; &=
nbsp; "en_fr"=
;, "I'm going to the beach."});
<br>  =
;runClient(new String[]{<br><br>"<a href=3D"http://www.webservicex.net=
/ValidateEmail.asmx?wsdl">http://www.webservicex.net/ValidateEmail.asmx?wsd=
l</a>", "IsValidEMail",<br>"<a href=3D"mailto:aleksande=
r_at_example.com">
aleksander_at_example.com</a>"});<br><br> &n=
bsp; runClient(new String[]{<br><br>&quo=
t;<a href=3D"http://www.xmethods.net/sd/2001/TemperatureService.wsdl">http:=
//www.xmethods.net/sd/2001/TemperatureService.wsdl</a>", "getTemp=
",
<br>"02067"});<br>  =
; // java.io.IOException: Server returned HTTP respo=
nse code:<br>502 for URL:<br><a href=3D"http://services.xmethods.net/soap/u=
rn:xmethods-delayed-quotes.wsdl">http://services.xmethods.net/soap/urn:xmet=
hods-delayed-quotes.wsdl
</a><br> &=
nbsp;// runClien=
t(new String[]{<br> &n=
bsp; //<br>"<a href=3D"http://services.xmethods.net/soap/ur=
n:xmethods-delayed-quotes.wsdl">http://services.xmethods.net/soap/urn:xmeth=
ods-delayed-quotes.wsdl
</a>",<br> =
// &=
nbsp; &nbs=
p; "getQuote", "IBM"});<br=
> ru=
nClient(new String[]{<br><br>"<a href=3D"http://mssoapinterop.org/asmx=
/xsd/round4XSD.wsdl">http://mssoapinterop.org/asmx/xsd/round4XSD.wsdl
</a>", "echoString", "Hello<br>World!!!"});<br>&nb=
sp; runCli=
ent(new String[]{<br><br>"<a href=3D"http://samples.gotdotnet.com/quic=
kstart/aspplus/samples/services/MathService/VB/MathService.asmx?WSDL">
http://samples.gotdotnet.com/quickstart/aspplus/samples/services/MathServic=
e/VB/MathService.asmx?WSDL</a>",<br> &nbs=
p; &=
nbsp; "Add",=
"3", "4"});<br> &nb=
sp; runClient(new String[]{ //somet=
imes timeout
<br><br>"<a href=3D"http://www.webservicex.net/stockquote.asmx?WSDL">h=
ttp://www.webservicex.net/stockquote.asmx?WSDL</a>", "GetQuote&qu=
ot;, "IBM"});<br> =
// &=
nbsp; runClient(new String[]{ //FAILING - cant =
find
<br>WSDL<br> &nb=
sp; //<br>"<a href=3D"http://developerdays.com/cgi-bin/tempconver=
ter.exe/wsdl/ITempConverter">http://developerdays.com/cgi-bin/tempconverter=
.exe/wsdl/ITempConverter</a>",<br>"CtoF", "32"});
<br>  =
;runClient(new String[]{<br>  =
; &n=
bsp; "<a href=3D"http://www.webservicex.net/icd10.asm=
x?WSDL">http://www.webservicex.net/icd10.asmx?WSDL</a>",<br>"GetI=
CD10", "foo"});
<br>  =
;//simple <a href=3D"http://www.ghettodriveby.com/soap/?wsdl">http://www.gh=
ettodriveby.com/soap/?wsdl</a><br>  =
; //wsdl:import test<br><a href=3D"http://euti=
ls.ncbi.nlm.nih.gov/entrez/eutils/soap/eutils.wsdl">
http://eutils.ncbi.nlm.nih.gov/entrez/eutils/soap/eutils.wsdl</a><br> =
runClient=
(new String[]{<br><br>"<a href=3D"http://ws.netviagens.com/webservices=
/AirFares.asmx?wsdl">http://ws.netviagens.com/webservices/AirFares.asmx?wsd=
l
</a>", "GetFares",<br> &n=
bsp;  =
; "", "=
JFK", "WAW", "2005-01-20", "2005-02-02" =
});<br> } else {<br> &n=
bsp; runClient(a=
rgs);<br> }
<br> }<br><br> private static=
void runClient(String[] args) throws Exception {<br> &nbs=
p; //args[0] =3D<br> &n=
bsp; URI base =3D ((new File(".")).toURI());<br><br>&n=
bsp; if(args.length < 2) {<br>&=
nbsp; usag=
e("at least two argument required");
<br> }<br><br> &n=
bsp; String wsdlLoc =3D args[0];<br> &nbs=
p; //System.out.println("loaded def=
=3D"+def);<br><br> Stri=
ng opName =3D args[1];<br> S=
tring portName =3D null;<br>  =
;if(opName.charAt(0) =3D=3D '{') {
<br>  =
;int pos =3D opName.indexOf('}');<br> &n=
bsp; portName =3D opName.substring(1, pos);<br=
> op=
Name =3D opName.substring(pos+1);<br> &n=
bsp; }<br><br> //System=
.out.println("invoking Google WS with query '"+query+"'
<br>using WSDL from "+wsdlLoc);<br>  =
; System.err.println("invoking operation '"+opName+&qu=
ot;' using WSDL<br>from "+wsdlLoc);<br><br> &nb=
sp; //MLogger.setCmdNames(":ALL");<br> &nbs=
p; WsdlDefinitions def =3D=20
WsdlResolver.getInstance().loadWsdl(base,<br>new URI(wsdlLoc));<br><br>&nbs=
p; WSIFServiceFactory wsf =3D WSIF=
ServiceFactory.newInstance();<br> =
WSIFService serv =3D wsf.getService(def);<br><br> &n=
bsp; WSIFPort port =3D serv.getPort
(portName);<br><br> WSIFOper=
ation op =3D port.createOperation(opName);<br>  =
; WSIFMessage in =3D op.createInputMessage();<br><br><br>&=
nbsp; WsdlBindingOperation binding=
Op =3D op.getBindingOperation();<br> &nbs=
p; WsdlPortTypeOperation portTypeOp =3D=20
bindingOp.lookupOperation();<br> &=
nbsp;WsdlMessage inputMsg =3D portTypeOp.getInput().lookupMessage();<br>&nb=
sp; Iterator partNames =3D in.part=
Names().iterator();<br><br> =
//WSDL URL =3D - =3D=3D> read from stdin<br> &nbs=
p; //allow arguments:
<br> //1. [position=3D]value=
only allowed as first arguments if<br>position not specified (this is POSI=
TIONAL!)<br> // &=
nbsp; position 1...<br>  =
;//2. name=3Dvalue<br> //4. =
[name]=3D<xml>value<br> &nbs=
p;//
<br><br> //-Depr=3D- =3D=3D&=
gt; read from stdin<br> //-D=
select=3D"XPATH filter"<br><br> &nbs=
p; //process arguments<br> &n=
bsp; // deal with stupid element=3D wrapping and other stuff (special<=
br>case for one part hat is element) ...
<br><br><br> // &=
nbsp; for (int i =3D 2; i < args.length; i+=
+) {<br> //  =
; //determine type of =
argument<br> // &=
nbsp; String partName =
=3D (String) partNames.next();<br>//partNames.get(i-2);
<br> // &nb=
sp; String partValue =3D arg=
s[i];<br> // &nbs=
p; System.err.println(=
partName+"=3D"+partValue);<br>  =
; // =
in.setObjectPart(partName, partValue);<br> &nb=
sp; // &nbs=
p;}<br>
<br> int count =3D 2;<br>&nb=
sp; while(partNames.hasNext()) {<b=
r> /=
/determine type of argument<br> &n=
bsp; String partName =3D (String) partNames.next();<=
br>//partNames.get(i-2);<br>  =
; if(count <=20
args.length) {<br> &nb=
sp; String partValue =3D args[count];<br=
> &n=
bsp; System.err.println(partName+"=3D"+partValue=
);<br> &nb=
sp; in.setObjectPart(partName, partValue);<br> =
} else {<=
br>
&nb=
sp; // will try to do some defaulting<br>  =
; &n=
bsp;QName type =3D ((WSIFMessageElement)in).getPartType(partName);<br><br>&=
nbsp; &nbs=
p; String localPart =3D type.getLocalPart();<br> &nbs=
p; &=
nbsp; if("string".equals(localPart)) {
<br>  =
; String DEFAULT_STRING =3D =
"foo string";<br> =
in.=
setObjectPart(partName, DEFAULT_STRING);<br> &=
nbsp; &nbs=
p; System.err.println("defaulting<br>"+partName+"=
=3D"+in.getObjectPart(partName));
<br>  =
; } else if("anyURI".equals(localPart)) {<=
br> =
String DEFAULT_URI =3D &quo=
t;gsiftp://rainier//tmp/foo.txt";<br> &nb=
sp; =
in.setObjectPart(partName, DEFAULT_URI);<br>
&nb=
sp; System.err.println("defau=
lting<br>"+partName+"=3D"+in.getObjectPart(partName));<br>&n=
bsp;  =
; } else if("URIArrayType".equals(localPart)) {<=
br> =
XmlElement arrayEl =3D=20
builder.newFragment(partName);<br>  =
; &n=
bsp;String DEFAULT_URI_ARRAY_ITEM =3D<br>"gsiftp://rainier//tmp/foo.tx=
t";<br><br>arrayEl.addElement("value").addChild(DEFAULT_URI_=
ARRAY_ITEM);<br>  =
; =20
in.setObjectPart(partName, arrayEl);<br>  =
; &n=
bsp; System.err.println("defaulting<br>"+partName+"=3D&=
quot;+in.getObjectPart(partName));<br> &=
nbsp; }<br>  =
; }<br><br> =
; ++count;
<br> }<br><br> &n=
bsp; {<br> =
WSIFMessageElement inputMessage =3D ((W=
SIFMessageElement)in);<br> &=
nbsp; XmlNamespace ns =3D inputMessage.getNamespace(); // =
it is<br>qualified - children element must have namespace
<br>  =
;inputMessage.addElement(ns, "item").addChild("keyboard"=
;);<br> }<br> &nb=
sp; // &nbs=
p; in.setObjectPart("key", key);<br> =
// i=
n.setObjectPart("q", query);
<br> // &nb=
sp; in.setObjectPart("start", "0"=
;);<br> // =
in.setObjectPart("maxResults", &quo=
t;10");<br> // &nb=
sp; in.setObjectPart("filter",=
"true");
<br> // &nb=
sp; //restrict xsi:type=3D"xsd:string"<br>=
// &=
nbsp; in.setObjectPart("safeSearch", "false=
");<br> // &=
nbsp; //lr xsi:type=3D"xsd:string"<b=
r> //  =
;
in.setObjectPart("ie", "latin1");<br> =
// &=
nbsp;in.setObjectPart("oe","latin1");<br> &n=
bsp; if(op.isRequestResponseOperation()) {<br>=
WSI=
FMessage out =3D op.createOutputMessage
();<br> &n=
bsp;WSIFMessage fault =3D op.createFaultMessage();<br> &nb=
sp; boolean succes =3D op.ex=
ecuteRequestResponseOperation(in, out,<br>fault);<br> &nbs=
p; if(succes) {<br> &nb=
sp; =
System.err.println("received response "+out);
<br>  =
;} else {<br> &n=
bsp; System.err.println("received fault &=
quot;+fault);<br> &nbs=
p; }<br> } else {=
<br>  =
;op.executeInputOnlyOperation(in);<br> &=
nbsp; System.out.println("input only mess=
age was sent successfully");
<br> }<br> =
}<br><br> private static void addListOfElement=
Names(XmlElement sequenceEl,<br>List partNames) {<br> &nbs=
p; for(Iterator ei =3D<br>sequenceEl.requiredElement=
Content().iterator(); ei.hasNext(); ) {<br>
Xml=
Element xsdSomething =3D (XmlElement) ei.next();<br>  =
; if(! xsdSomething.getName(=
).equals("element")) {<br> &nb=
sp; throw new WSIFExce=
ption("only xsd:element is supported<br>in xsd:sequence");
<br>  =
;}<br> &nb=
sp;String name =3D xsdSomething.getAttributeValue(null, "name");<=
br> =
logger.fine("adding sequence element name=3D"+name);<br> &nb=
sp; partNames.ad=
d(name);<br> }
<br><br> }<br><br><br>}<br><br>/*<br> * Indiana Univ=
ersity Extreme! Lab Software License, Version 1.2<br> *<br> * Copyright (c)=
2002-2005 The Trustees of Indiana University.<br> * All rights reserved.<b=
r> *<br> * Redistribution and use in source and binary forms, with or witho=
ut
<br> * modification, are permitted provided that the following conditions a=
re<br> * met:<br> *<br> * 1) All redistributions of source code must retain=
the above<br> * copyright notice, the list of autho=
rs in the original source
<br> * code, this list of conditions and the disclai=
mer listed in this<br> * license;<br> *<br> * 2) All=
redistributions in binary form must reproduce the above<br> * &=
nbsp; copyright notice, this list of conditions and the disclaimer
<br> * listed in this license in the documentation a=
nd/or other<br> * materials provided with the distri=
bution;<br> *<br> * 3) Any documentation included with all redistributions =
must include<br> * the following acknowledgement:
<br> *<br> * "This product includes=
software developed by the Indiana<br> *  =
;University Extreme! Lab. For further information please visit<b=
r> * <a href=3D"http://www.extreme.india=
na.edu/">http://www.extreme.indiana.edu/
</a>"<br> *<br> * Alternatively, this acknowled=
gment may appear in the software<br> * itself, and w=
herever such third-party acknowledgments normally<br> * &n=
bsp;appear.<br> *<br> * 4) The name "Indiana University" or "=
;Indiana University
<br> * Extreme! Lab" shall not be used to endor=
se or promote<br> * products derived from this softw=
are without prior written<br> * permission from Indi=
ana University. For written permission,<br> * &=
nbsp;please contact=20
<a href=3D"http://www.extreme.indiana.edu/">http://www.extreme.indiana.edu/=
</a>.<br> *<br> * 5) Products derived from this software may not use "=
Indiana<br> * University" name nor may "In=
diana University" appear in their name,
<br> * without prior written permission of the India=
na University.<br> *<br> * Indiana University provides no reassurances that=
the source code<br> * provided does not infringe the patent or any other i=
ntellectual<br> * property rights of any other entity. Indiana U=
niversity disclaims any
<br> * liability to any recipient for claims brought by any other entity<br=
> * based on infringement of intellectual property rights or otherwise.<br>=
*<br> * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" F=
OR WHICH
<br> * NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA<br> *=
UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT<br> * SOFT=
WARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR<br> * OTH=
ER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES TH=
AT
<br> * SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "T=
ROJAN HORSES", "TRAP<br> * DOORS", "WORMS", OR OTH=
ER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE<br> * RISK AS TO TH=
E PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS,
<br> * AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING<b=
r> * SOFTWARE.<br> */<br><br>java -Dlog xsul.dii.XsulDynamicInvoker "!=
MISC/andre/GetPrice.wsdl"<br>getPrice keyboard<br>MLogger $Revision:=
=20
1.8 $ $Date: 2005/02/16 05:52:51 $ (GMT) configured<br>as '' (XS=
UL version compile-time:2.7.9 runtime:2.7.9)<br>Starting xsul.dii.XsulDynam=
icInvoker<br>invoking operation 'getPrice' using WSDL from !MISC/andre/GetP=
rice.wsdl
<br>[ 18:52:58.769 main: xsul.wsif.impl.WSIFMessageElement.java:88<br>addPl=
aceholderForParameters 5]<br>elementPartQName=3D{<a href=3D"http://tempuri.=
org/}getPrice">http://tempuri.org/}getPrice</a><br>[ 18:52:58.920 main: xsu=
l.wsif.impl.WSIFMessageElement.java
:184<br>addPlaceholderForParameters 5] special messageIn=3D<n1:getPrice<=
br>xmlns:n1=3D"<a href=3D"http://tempuri.org/">http://tempuri.org/</a>=
" /><br>[ 18:52:58.920 main: xsul.wsif.impl.WSIFMessageElement.java=
:195
<br>addPlaceholderForParameters 5] messageIn=3D<n1:getPrice<br>xmlns:n1=
=3D"<a href=3D"http://tempuri.org/">http://tempuri.org/</a>" />=
;<br>[ 18:52:58.940 main: xsul.wsif.impl.WSIFMessageElement.java:88<br>addP=
laceholderForParameters 5]
<br>elementPartQName=3D{<a href=3D"http://tempuri.org/}getPriceResult">http=
://tempuri.org/}getPriceResult</a><br>[ 18:52:58.940 main: xsul.wsif.impl.W=
SIFMessageElement.java:245<br>addListOfElementNames 3] adding sequence elem=
ent type
<br>name=3DgetPriceResult typeQName=3D{<a href=3D"http://www.w3.org/2001/XM=
LSchema}double">http://www.w3.org/2001/XMLSchema}double</a><br>[ 18:52:58.9=
40 main: xsul.wsif.impl.WSIFMessageElement.java:252<br>addListOfElementName=
s 3] adding sequence element name=3DgetPriceResult
<br>[ 18:52:58.940 main: xsul.wsif.impl.WSIFMessageElement.java:177<br>addP=
laceholderForParameters 1] name=3DgetPriceResult<br>[ 18:52:58.940 main: xs=
ul.wsif.impl.WSIFMessageElement.java:184<br>addPlaceholderForParameters 5] =
special messageIn=3D<n1:getPriceResult
<br>xmlns:n1=3D"<a href=3D"http://tempuri.org/">http://tempuri.org/</a=
>"><n1:getPriceResult /></n1:getPriceResult><br>[ 18:52=
:58.950 main: xsul.wsif.impl.WSIFMessageElement.java:195<br>addPlaceholderF=
orParameters 5] messageIn=3D<n1:getPriceResult
<br>xmlns:n1=3D"<a href=3D"http://tempuri.org/">http://tempuri.org/</a=
>"><n1:getPriceResult /></n1:getPriceResult><br>[ 18:52=
:58.960 main:<br>xsul.invoker.http.HttpDynamicInfosetInvoker.java:248 invok=
eXml 1]
<br>host=3Dlocalhost port=3D80 secure=3Dfalse<br>[ 18:52:58.960 main:<br>xs=
ul.http_client.plain_impl.PlainClientSocketFactory.java:45 connect 1]<br>co=
nnect localhost:80 timeout:240000<br>[ 18:52:59.250 main: trace.xsul.http.c=
lient.out
<br>xsul.http_client.HttpClientRequest.java:244 writeHeaders 1] TRACE:<br>s=
ending request headers:---<br>POST /GetPrice/Service.asmx HTTP/1.0\r<br>Hos=
t: localhost\r<br>User-Agent: XSUL/2.7.9\r<br>Content-Type: text/xml; chars=
et=3Dutf-8\r
<br>Content-Length: 563\r<br>Keep-Alive: 300\r<br>SOAPAction: \"<a hre=
f=3D"http://tempuri.org/getPrice\">http://tempuri.org/getPrice\</a>"\r=
<br>Connection: keep-alive\r<br>\r<br>---<br><br>[ 18:52:59.280 main: trace=
.xsul.http.client.out
<br>xsul.http_client.HttpClientRequest.java:284 closeRequest 1] TRACE:<br>s=
ending request body:---<br><?xml version=3D'1.0' encoding=3D'utf-8'?>=
<S:Envelope<br>xmlns:xsd=3D'<a href=3D"http://www.w3.org/2001/XMLSchema"=
>http://www.w3.org/2001/XMLSchema
</a>'<br>xmlns:xsi=3D'<a href=3D"http://www.w3.org/2001/XMLSchema-instance"=
>http://www.w3.org/2001/XMLSchema-instance</a>'<br>xmlns:wsa=3D'<a href=3D"=
http://www.w3.org/2005/08/addressing">http://www.w3.org/2005/08/addressing<=
/a>'
<br>xmlns:wsp=3D'<a href=3D"http://schemas.xmlsoap.org/ws/2002/12/policy">h=
ttp://schemas.xmlsoap.org/ws/2002/12/policy</a>'<br>xmlns:S=3D'<a href=3D"h=
ttp://schemas.xmlsoap.org/soap/envelope/'">http://schemas.xmlsoap.org/soap/=
envelope/'
</a>><S:Header><wsa:To><a href=3D"http://localhost/GetPrice/=
Service.asmx">http://localhost/GetPrice/Service.asmx</a></wsa:To><=
wsa:Action><a href=3D"http://tempuri.org//ServiceSoap/getPrice">http://t=
empuri.org//ServiceSoap/getPrice
</a></wsa:Action></S:Header><S:Body><n1:getPrice<br>xm=
lns:n1=3D'<a href=3D"http://tempuri.org/'">http://tempuri.org/'</a>><=
n1:item>keyboard</n1:item></n1:getPrice></S:Body></=
S:Envelope>---
<br><br>><br>> Thanks in advance for any help!<br>><br>> Best r=
egards,<br>><br>> Andre<br>><br>><br>> ############### ENVEL=
OPE ################<br>> <?xml version=3D'1.0' encoding=3D'utf-8'?&g=
t;
<br>> <S:Envelope xmlns:xsd=3D' <a href=3D"http://www.w3.org/2001/XML=
Schema">http://www.w3.org/2001/XMLSchema</a>' xmlns:xsi=3D'<br>> <a href=
=3D"http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSc=
hema-instance
</a>' xmlns:wsa=3D'<br>> <a href=3D"http://www.w3.org/2005/08/addressing=
">http://www.w3.org/2005/08/addressing</a>'<br>> xmlns:wsp=3D'<a href=3D=
"http://schemas.xmlsoap.org/ws/2002/12/policy">http://schemas.xmlsoap.org/w=
s/2002/12/policy
</a><br>> <<a href=3D"http://schemas.xmlsoap.org/ws/2002/12/policy">h=
ttp://schemas.xmlsoap.org/ws/2002/12/policy</a>>'<br>> xmlns:S=3D'<a =
href=3D"http://schemas.xmlsoap.org/soap/envelope/">http://schemas.xmlsoap.o=
rg/soap/envelope/
</a>'<br>> <<a href=3D"http://schemas.xmlsoap.org/soap/envelope/%27">=
http://schemas.xmlsoap.org/soap/envelope/%27</a>>><br>>  =
; <S:Header><br>> <wsa:To>=
;<a href=3D"http://localhost/GetPrice/Service.asmx">
http://localhost/GetPrice/Service.asmx</a></wsa:To><br>> &nbs=
p; <wsa:Action> <a href=3D"http://tempuri.org/=
/ServiceSoap/getPrice">http://tempuri.org//ServiceSoap/getPrice</a></wsa=
:Action><br>> </S:Header>
<br>> <S:Body><br>> &n=
bsp;<n1:item xmlns:n1=3D' <a href=3D"http://tempuri.org/">http://tempuri=
.org/</a>' /><br>> </S:Body><br>> </S:Envelop=
e><br>><br>><br>><br>> ############### WSDL ################
<br>> <?xml version=3D"1.0" encoding=3D"ut=
f-8" ?><br>> - <#> <wsdl:definitions xmlns:soap<br>>=
=3D"*<a href=3D"http://schemas.xmlsoap.org/wsdl/soap/*">http://schema=
s.xmlsoap.org/wsdl/soap/*
</a>" xmlns:tm=3D"<br>> *<a href=3D"http://microsoft.com/wsdl/=
mime/textMatching/*">http://microsoft.com/wsdl/mime/textMatching/*</a>"=
; xmlns:soapenc=3D"<br>> *<a href=3D"http://schemas.xmlsoap.org/soa=
p/encoding/*">
http://schemas.xmlsoap.org/soap/encoding/*</a>" xmlns:mime=3D"*<b=
r>> <a href=3D"http://schemas.xmlsoap.org/wsdl/mime/*">http://schemas.xm=
lsoap.org/wsdl/mime/*</a>" xmlns:tns=3D"*<br>> <a href=3D"http=
://tempuri.org/*">
http://tempuri.org/*</a>" xmlns:s=3D"*<a href=3D"http://www.w3.or=
g/2001/XMLSchema*">http://www.w3.org/2001/XMLSchema*</a>"<br>> xmln=
s:soap12 =3D"*<a href=3D"http://schemas.xmlsoap.org/wsdl/soap12/*">htt=
p://schemas.xmlsoap.org/wsdl/soap12/*
</a>"<br>> xmlns:http=3D"* <a href=3D"http://schemas.xmlsoap.o=
rg/wsdl/http/*">http://schemas.xmlsoap.org/wsdl/http/*</a>"<br>> ta=
rgetNamespace=3D"* <a href=3D"http://tempuri.org/*">http://tempuri.org=
/*</a>
"<br>> xmlns:wsdl=3D"*<a href=3D"http://schemas.xmlsoap.org/ws=
dl/*">http://schemas.xmlsoap.org/wsdl/*</a>"><br>> - <#> &=
lt;wsdl:types><br>> - <#> <s:schema elementFormDefault =3D&q=
uot;*qualified*"
<br>> targetNamespace=3D"*<a href=3D"http://tempuri.org/*">http://t=
empuri.org/*</a>"><br>> - <#> <s:element name =3D"=
*item*"><br>> - <#> <s:complexType><br>> - <#&=
gt; <s:sequence>
<br>> <s:element minOccurs=3D"*0* " maxOccurs=
=3D"*1*" name=3D"*item*"<br>> type=3D"*s:string=
*" /><br>> </s:sequence><br>> &=
lt;/s:complexType><br>> </s:element>
<br>> - <#> <s:element name =3D"*getPriceResponse*"&g=
t;<br>> - <#> <s:complexType><br>> - <#> <s:sequ=
ence><br>> <s:element minOccurs=3D"*1* " max=
Occurs=3D"*1*" name=3D"*getPriceResult*"
<br>> type=3D"*s:double*" /><br>> </s:seq=
uence><br>> </s:complexType><br>> &l=
t;/s:element><br>> </s:schema><br>> =
</wsdl:types><br>> - <#> <wsdl:message name =3D"*get=
PriceSoapIn*">
<br>> <wsdl:part name=3D"*parameters* " element=
=3D"*tns:item*" /><br>> </wsdl:message><b=
r>> - <#> <wsdl:message name =3D"*getPriceSoapOut*"&g=
t;<br>> <wsdl:part name=3D"*parameters* " eleme=
nt=3D"*tns:getPriceResponse*" />
<br>> </wsdl:message><br>> - <#> <wsdl:por=
tType name =3D"*ServiceSoap*"><br>> + <#> <wsdl:op=
eration name =3D"*getPrice*"><br>> <wsdl:inp=
ut message=3D"*tns:getPriceSoapIn* " />
<br>> <wsdl:output message=3D"*tns:getPriceSoapOut* =
" /><br>> </wsdl:operation><br>>  =
; </wsdl:portType><br>> - <#> <wsdl:binding name =3D"=
;*ServiceSoap*" type=3D"*tns:ServiceSoap*">
<br>> <soap:binding transport=3D"* <a href=3D"http:/=
/schemas.xmlsoap.org/soap/http*">http://schemas.xmlsoap.org/soap/http*</a>&=
quot; /><br>> - <#> <wsdl:operation name =3D"*getPrice*=
"><br>
> <soap:operation soapAction=3D"* <a href=3D"http://=
tempuri.org/getPrice*">http://tempuri.org/getPrice*</a>"<br>> style=
=3D"*document*" /><br>> - <#> <wsdl:input><br>&=
gt; <soap:body use=3D"*literal* " />
<br>> </wsdl:input><br>> - <#> <wsdl:outpu=
t><br>> <soap:body use=3D"*literal* " /><=
br>> </wsdl:output><br>> </wsdl:oper=
ation><br>> </wsdl:binding>
<br>> - <#> <wsdl:binding name =3D"*ServiceSoap12*" t=
ype=3D"*tns:ServiceSoap*"><br>> <soap12:bind=
ing transport=3D"* <a href=3D"http://schemas.xmlsoap.org/soap/http*">h=
ttp://schemas.xmlsoap.org/soap/http*
</a>" /><br>> - <#> <wsdl:operation name =3D"*getP=
rice*"><br>> <soap12:operation soapAction=3D"=
;* <a href=3D"http://tempuri.org/getPrice*">http://tempuri.org/getPrice*</a=
>"<br>> style=3D"*document*" />
<br>> - <#> <wsdl:input><br>> <soap12:body=
use=3D"*literal* " /><br>> </wsdl:input>=
<br>> - <#> <wsdl:output><br>> <soap12:bod=
y use=3D"*literal* " />
<br>> </wsdl:output><br>> </wsdl:ope=
ration><br>> </wsdl:binding><br>> - <#> &l=
t;wsdl:service name =3D"*Service*"><br>> - <#> <ws=
dl:port name =3D"*ServiceSoap*" binding=3D"*tns:ServiceSoap*=
">
<br>> <soap:address location=3D"* <a href=3D"http://=
localhost/GetPrice/Service.asmx*">http://localhost/GetPrice/Service.asmx*</=
a>" /><br>> </wsdl:port><br>> - <#> &=
lt;wsdl:port name =3D"*ServiceSoap12*" binding=3D"*tns:Servi=
ceSoap12*">
<br>> <soap12:address location=3D"* <a href=3D"http:=
//localhost/GetPrice/Service.asmx*">http://localhost/GetPrice/Service.asmx*=
</a>" /><br>> </wsdl:port><br>> =
</wsdl:service><br>> </wsdl:definitions>
<br>><br>><br>><br>><br>><br>><br>> ##################=
###### JAVA #########################<br>><br>> import java.io.File ;=
<br>> import java.net.URI;<br>> import java.util.Iterator;<br>> im=
port=20
java.util.List;<br>> import javax.xml.namespace.QName;<br>> import or=
g.xmlpull.v1.builder.XmlElement;<br>> import org.xmlpull.v1.builder.XmlI=
nfosetBuilder;<br>> import xsul.MLogger;<br>> import xsul.XmlConstant=
s
;<br>> import xsul.wsdl.WsdlBindingOperation;<br>> import xsul.wsdl.W=
sdlDefinitions;<br>> import xsul.wsdl.WsdlMessage;<br>> import xsul.w=
sdl.WsdlPortTypeOperation;<br>> import xsul.wsdl.WsdlResolver ;<br>> =
import=20
xsul.wsif.WSIFException;<br>> import xsul.wsif.WSIFMessage;<br>> impo=
rt xsul.wsif.WSIFOperation;<br>> import xsul.wsif.WSIFPort;<br>> impo=
rt xsul.wsif.WSIFService;<br>> import xsul.wsif.WSIFServiceFactory;<br>
> import xsul.wsif.impl.WSIFMessageElement ;<br>> import xsul.wsif.sp=
i.WSIFProviderManager;<br>><br>> public class XsulDynamicInvoker {<br=
>> private final static MLogger logger =3D MLogg=
er.getLogger();<br>
> private final static XmlInfosetBuilder builder=
=3D<br>> XmlConstants.BUILDER ;<br>><br>> =
private static void usage(String errMsg) {<br>> =
System.err.println("Usage: {WSDL URL} {operat=
ion name}
<br>> [parameters ...]");<br>> }<br>>=
<br>> public static void main(String[] args) thr=
ows Exception<br>> {<br>> &n=
bsp; System.err.println("Starting<br>> &quo=
t;+XsulDynamicInvoker.class.getName());
<br>> WSIFProviderManage=
r.getInstance().addProvider( new<br>> xsul.wsif_xsul_soap_http.Provider(=
) );<br>> runClient(args=
);<br>> }<br>><br>>  =
; private static void runClient(String[] args) throws Exception {
<br>> URI base =3D ((new=
File(".")).toURI());<br>><br>> &nbs=
p; if(args.length < 2) {<br>> &nbs=
p; usage("at least two=
argument required");<br>>  =
; }<br>><br>> S=
tring wsdlLoc =3D args[0];
<br>><br>> String opN=
ame =3D args[1];<br>> St=
ring portName =3D null;<br>> &n=
bsp; if(opName.charAt(0) =3D=3D '{') {<br>>  =
; int pos =3D opName.indexOf('}')=
;<br>> =
portName =3D opName.substring
(1, pos);<br>> &nbs=
p; opName =3D opName.substring(pos+1);<br>>  =
; }<br>><br>> &n=
bsp; System.err.println("invoking operation '"+=
opName+"' using WSDL<br>> from "+wsdlLoc);<br>> =
//log everything!
<br>> MLogger.setCmdName=
s(":ALL");<br>>  =
; WsdlDefinitions def =3D<br>> WsdlResolver.getInstance().loadWsdl(base,=
new URI(wsdlLoc));<br>><br>> &nbs=
p; WSIFServiceFactory wsf =3D WSIFServiceFactory.newInstance
();<br>> WSIFService ser=
v =3D wsf.getService(def);<br>><br>> &nb=
sp; WSIFPort port =3D serv.getPort(portName);<br>><br>>&n=
bsp; WSIFOperation op =3D port.cr=
eateOperation(opName);<br>> &nb=
sp; WSIFMessage in =3D=20
op.createInputMessage();<br>><br>>  =
; WsdlBindingOperation bindingOp =3D op.getBindingOp=
eration();<br>> WsdlPort=
TypeOperation portTypeOp =3D bindingOp.lookupOperation();<br>> &nbs=
p; WsdlMessage inputMsg =3D=20
portTypeOp.getInput().lookupMessage();<br>>  =
; Iterator partNames =3D in.partNames().iterator();<br>&g=
t;<br>> int count =3D 2;=
<br>> while(partNames.ha=
sNext()) {<br>> &nb=
sp; //determine type of argument
<br>> &=
nbsp; String partName =3D (String) partNames.next ();<br>> //partNames.g=
et(i-2);<br>>  =
; if(count < args.length) {<br>> &=
nbsp; Str=
ing partValue =3D args[count];<br>> &=
nbsp; =20
System.err.println(partName+"=3D"+partValue);<br>> =
&nb=
sp; in.setObjectPart (partName, partValue);<br>> =
} else {<br>>&nbs=
p; &=
nbsp; // will try to do some defaulting<br>> &nbs=
p; &=
nbsp; QName type =3D
<br>> ((WSIFMessageElement)in).getPartType(partName);<br>><br>>&nb=
sp; =
String localPart =3D type.getLocalPart();<br>> &=
nbsp; &nbs=
p; if("string".equals(localPart)) {<br>> &nbs=
p; &=
nbsp; =20
in.setObjectPart(partName, "foo string");<br>> &nbs=
p; &=
nbsp; System.err.println("defaulting<br>> &=
quot;+partName+"=3D"+in.getObjectPart(partName));<br>> &n=
bsp;  =
; } else if("anyURI".equals(localPart)) {
<br>> &=
nbsp; in.setObjectPart(part=
Name,<br>> "gsiftp://rainier//tmp/foo.txt");<br>> &nbs=
p; &=
nbsp; System.err.println("defaulting<br>=
> "+partName+"=3D"+in.getObjectPart(partName));
<br>> &=
nbsp; } else if("URIArrayType".equals(loc=
alPart)) {<br>> &nb=
sp; XmlElement =
arrayEl =3D builder.newFragment(partName);<br>><br>> arrayEl.addEleme=
nt("value").addChild("gsiftp://rainier//tmp/foo.txt");
<br>> &=
nbsp; in.setObje=
ctPart(partName, arrayEl);<br>>  =
; &n=
bsp; System.err.println("defaulting<br>> "+partName+"=3D&=
quot;+in.getObjectPart(partName));<br>> &nb=
sp; }
<br>> &=
nbsp; }<br>> =
++count;<br>> &nbs=
p; }<br>><br>> if(op.=
isRequestResponseOperation()) {<br>> =
WSIFMessage out =3D op.createOutputMes=
sage();<br>> =
WSIFMessage fault =3D=20
op.createFaultMessage();<br>> &=
nbsp; boolean succes =3D op.executeRequestResponseO=
peration(in,<br>> out, fault);<br>> &nbs=
p; if(succes) {<br>> &nbs=
p; &=
nbsp; System.out.println("received response "+out);
<br>> &=
nbsp; } else {<br>>  =
; System.err.println("receiv=
ed fault "+fault);<