[xgws-user] Dynamic Invocation Error

Aleksander Slominski aslom_at_cs.indiana.edu
Tue, 15 May 2007 10:51:29 -0400


Velidanda Srinivas wrote:
> I tried the below scenarios, among which Scenario-III has something
> working but only after setting the
> complex type field names, values and targetNamespace manually.
>  
> I need a fix here
> 1. To retrieve complex type field names and corresponding
> targetNamespace dynamically and set values for fields in the for..loop.
you will need to parse XML schema - you can use one of XML schemas
libraries or do it on your own (XWSIF is doing minimal XML schemas parsin
> 2. To create an object for the complex type returned from web service
> without having prebuilt return type class(Ex:LogonOutTO) at client side.
that is what already WSIF API does - you get what was received in output
or fault WSIFMessage
>
> Below are the scenarios in detail.
>
> *Scenario - I
> *
> Empty soapAction found in wsdl, then wsa:Action is set with default value
>
> SOAP request sent is as below
>  ============================
> POST /sppj/services/PlatformManagerService HTTP/1.0
> Host: localhost:8089
> User-Agent: XSUL/2.10.2
> Content-Type: text/xml; charset=utf-8
> Content-Length: 675
> Keep-Alive: 300
> SOAPAction: ""
> Connection: keep-alive
>
> <?xml version='1.0' encoding='utf-8'?><S:Envelope
> xmlns:xsd='http://www.w3.org/2001/XMLSchema'
> <http://www.w3.org/2001/XMLSchema%27>
> xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
> <http://www.w3.org/2001/XMLSchema-instance%27>
> xmlns:wsa='http://www.w3.org/2005/08/addressing'
> <http://www.w3.org/2005/08/addressing%27>
> xmlns:wsp='http://schemas.xmlsoap.org/ws/2002/12/policy'
> <http://schemas.xmlsoap.org/ws/2002/12/policy%27>
> xmlns:S='http://schemas.xmlsoap.org/soap/envelope/'
> <http://schemas.xmlsoap.org/soap/envelope/%27>><S:Header><wsa:To>http://localhost:8089/sppj/services/PlatformManagerService</wsa:To>
> <wsa:Action>http://singularity.co.uk/webservices/spp/PlatformManagerServicePortType/logon</wsa:Action></S:Header><S:Body><n1:logon
> xmlns:n1='http://singularity.co.uk/webservices/spp'
> <http://singularity.co.uk/webservices/spp%27>><in0><item>1</item><item
> /><item>true</item><item>TEST</item></in0></n1:logon></S:Body></S:Envelope>
> ============================
>
> Here I got the below output with soap fault
> ===============Output=================
> Starting xsul.dii.XsulDynamicInvoker
>
> invoking operation 'logon' using WSDL from
> http://localhost:8089/sppj/services/PlatformManagerService?WSDL
>
> received fault <soap:Fault
> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><faultcode>soap:Client</faultcode><faultstring>Action    
> 'http://singularity.co.uk/webservices/spp/PlatformManagerServicePortType/logon'
> <http://singularity.co.uk/webservices/spp/PlatformManagerServicePortType/logon%27>
> was not found for service       
> http://localhost:8089/sppj/services/PlatformManagerService</faultstring></soap:Fault>
> ==============Ouputput=============
>
you should look into fault WSIFMessage
>
>
> *Scenario - II
> *
> wsa:Action tag omitted and the complex type field values are set using
> item tags.  
> Request sent is as below
>
> ===============current xsul client request after omiting wsa:action
> tag=============================
>
> <?xml version='1.0' encoding='utf-8'?><S:Envelope
> xmlns:xsd='http://www.w3.org/2001/XMLSchema'
> <http://www.w3.org/2001/XMLSchema%27>
> xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
> <http://www.w3.org/2001/XMLSchema-instance%27>
> xmlns:wsa='http://www.w3.org/2005/08/addressing'
> <http://www.w3.org/2005/08/addressing%27>
> xmlns:wsp='http://schemas.xmlsoap.org/ws/2002/12/policy'
> <http://schemas.xmlsoap.org/ws/2002/12/policy%27>
> xmlns:S='http://schemas.xmlsoap.org/soap/envelope/'
> <http://schemas.xmlsoap.org/soap/envelope/%27>><S:Header><wsa:To>http://localhost:8089/sppj/services/PlatformManagerService</wsa:To></S:Header><S:Body><n1:logon
> xmlns:n1='http://singularity.co.uk/webservices/spp'
> <http://singularity.co.uk/webservices/spp%27>><in0><item>1</item><item
> /><item>true</item><item>TEST</item></in0></n1:logon></S:Body></S:Envelope>
>
> ===============current xsul client request after omiting wsa:action
> tag=============================
>

>
> In this case the complex type object values are not at all set to the
> LogonInTO object, found while debugging server code
> and getting *Application specific exception* while validating the data
> elements of LogonInTO.
>
> *Scenario - III*
>
> wsa:Action tag omitted and the complex type field values are set using
> the exact element name tags and the namespace
> same as in WSDL manually to see if it works.
>
> Request sent in this case is as below
> ========================================
> POST /sppj/services/PlatformManagerService HTTP/1.0
> Host: localhost:8089
> User-Agent: XSUL/2.10.2
> Content-Type: text/xml; charset=utf-8
> Content-Length: 731
> Keep-Alive: 300
> SOAPAction: ""
> Connection: keep-alive
>
> <?xml version='1.0' encoding='utf-8'?><S:Envelope
> xmlns:xsd='http://www.w3.org/2001/XMLSchema'
> <http://www.w3.org/2001/XMLSchema%27>
> xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
> <http://www.w3.org/2001/XMLSchema-instance%27>
> xmlns:wsa='http://www.w3.org/2005/08/addressing'
> <http://www.w3.org/2005/08/addressing%27>
> xmlns:wsp='http://schemas.xmlsoap.org/ws/2002/12/policy'
> <http://schemas.xmlsoap.org/ws/2002/12/policy%27>
> xmlns:S='http://schemas.xmlsoap.org/soap/envelope/'
> <http://schemas.xmlsoap.org/soap/envelope/%27>><S:Header><wsa:To>http://localhost:8089/sppj/services/PlatformManagerService</wsa:To></S:Header><S:Body><n1:logon
> xmlns:n1='http://singularity.co.uk/webservices/spp'
> <http://singularity.co.uk/webservices/spp%27>><in0><logonProtocol
> xmlns='http://com.singularity.spp.to'
> <http://com.singularity.spp.to%27>>1</logonProtocol><password
> /><unConditional xmlns='http://com.singularity.spp.to'
> <http://com.singularity.spp.to%27>>true</unConditional><userId
> xmlns='http://com.singularity.spp.to'
> <http://com.singularity.spp.to%27>>TEST</userId></in0></n1:logon></S:Body></S:Envelope>
> =========================================
>
> With the above request everything working fine and I got the below
> response
>
great!
>
> ==================Response=====================
> Starting xsul.dii.XsulDynamicInvoker
>
> invoking operation 'logon' using WSDL from
> http://localhost:8089/sppj/services/PlatformManagerService?WSDL
>
> received response <n1:logonResponse
> xmlns:n1="http://singularity.co.uk/webservices/spp"><out
> n2:type="np:LogonOutTO" xmlns:np="http://com.singularity.spp.to"
> xmlns="http://singularity.co.uk/webservices/spp"
> xmlns:n2="http://www.w3.org/2001/XMLSchema-instance"><resourceId
> xmlns="http://com.singularity.spp.to">6DA3B330E71F425B875AFD828EE28F1F</resourceId><resourceName
> xmlns="http://com.singularity.spp.to">TEST</resourceName><sessionId
> xmlns="http://com.singularity.spp.to">B1CF520C4FB475A1184CFC0B2B1632B3</sessionId></out></n1:logonResponse>
>
> ==================Response======================
>
you can take WSIFMessage output and in XWSIF cast it to XmlElement and
then you can wither work with XPP3 API or convert XML to (J)DOM(4J) if
you like that API more
>
> I have doubts regarding Scenario III, as you said to set the names of
> the elements of complex type instead
> of setting the data items within <item> tags.
>
>    1... Is there a way to get the complex type element names parsing
> WSDL, or I need to set them manually ?
>     In case of LogonInTO, i am able to find only partName "in0" at
> runtime in the below part of code of
>     XsulDynamicInvoker.java, because of which I have introduced
> <<element_name>> tags.
>
>     *********************************************
>         while(partNames.hasNext()) {
>             //determine type of argument
>             String partName = (String) partNames.next();
> //partNames.get(i-2);
>     *********************************************
>    Please let me know how to get the names of elements of LogonInTO
> from WSDL at runtime.
>
it that what is it in WSDL?
>
>
>    2... And after getting the response, without having the LogonOutTO
> class at client, how to
>         create the LogonOutTO object with the data from the response.
>
you do not need to create any class you can read and process WSIF
message directly

HTH,

alek
>
>
> Thanks & Regards,
> Srinivas Velidanda.
>
>
> -----Original Message-----
> From: Aleksander Slominski [mailto:aslom_at_cs.indiana.edu]
> Sent: 14 May 2007 20:39
> To: Velidanda Srinivas
> Subject: Re: [xgws-user] Dynamic Invocation Error
>
>
> Velidanda Srinivas wrote:
> > I could not get it working with the changes made to set default URI
> > for wsa:Action, then I tried
> > to omit <wsa:Action> tag from the request by commenting the below line
> > of code
> > 
> > *//wsah.setAction(opInputWsaActionUri); in
> > prepareInputSoap() method of XsulSoapOperation.java*
> > 
> > and updated XsulDynamicInvoker.java to add the elements of the complex
> > object within item tags, and got the request as below.
> > ===============current xsul client request after omiting wsa:action
> > tag=============================
> > 
> > <?xml version='1.0' encoding='utf-8'?><S:Envelope
> > xmlns:xsd='http://www.w3.org/2001/XMLSchema'
> <http://www.w3.org/2001/XMLSchema%27>
> > xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
> <http://www.w3.org/2001/XMLSchema-instance%27>
> > xmlns:wsa='http://www.w3.org/2005/08/addressing'
> <http://www.w3.org/2005/08/addressing%27>
> > xmlns:wsp='http://schemas.xmlsoap.org/ws/2002/12/policy'
> <http://schemas.xmlsoap.org/ws/2002/12/policy%27>
> > xmlns:S='http://schemas.xmlsoap.org/soap/envelope/'
> <http://schemas.xmlsoap.org/soap/envelope/%27>><S:Header><wsa:To>http://localhost:8089/sppj/services/PlatformManagerService</wsa:To></S:Header><S:Body><n1:logon
> > xmlns:n1='http://singularity.co.uk/webservices/spp'
> <http://singularity.co.uk/webservices/spp%27>><in0*><item>1</item><item
> >
> /><item>true</item><item>TEST</item>*</in0></n1:logon></S:Body></S:Envelope>
> > 
> > ===============current xsul client request after omiting wsa:action
> > tag=============================
> so does it work or not? what is the error?
> > 
> > But there is a problem with request as the values are not getting set
> > to the actual object at runtime.
> > 
> > There is a difference between XFire client request and Xsul Client
> > request.
> > 
> > In case of Xfire request the actual names of the elements are set but
> > in case of xsul everything is set as individual "item" tags.
> > 
> > Please let me know
> > 1. Whether update made to omit wsa:Action is ok or not?
> it is OK if receiving service does not require WS-Addressing - the case
> here is an edge case as it seems that xfire does not require
> ws-addressing but fails in case when some of ws-addressing header
> elements are present ...
> > 2. How to get the internal element names of complex type object so
> > that to set the request with the element names instead of "item" tags.
> in XWSIF you can cast WSIFMessage to XmlElement and set all its content
> > 
> > I need the request to be same as the xfire request, so that the
> > runtime object is set with the values supplied in the request as below.
> what is the error you get?
> > 
> > I have the complex type defined in wsdl as below
> > 
> > <xsd:complexType name="*LogonInTO*">
> >     <xsd:sequence>
> > * * <xsd:element minOccurs="*0*" name="*logonProtocol*"
> > type="*xsd:short*" />
> > * * <xsd:element minOccurs="*0*" name="*password*" nillable="*true*"
> > type="*xsd:string*" />
> > * * <xsd:element minOccurs="*0*" name="*unConditional*"
> > type="*xsd:boolean*" />
> > * * <xsd:element minOccurs="*0*" name="*userId*" nillable="*true*"
> > type="*xsd:string*" />
> >     </xsd:sequence>
> > </xsd:complexType>
> > 
> > XFire request passing values of this object is as below
> > ===============xfire client request -START====================
> >  POST /sppj/services/PlatformManagerService HTTP/1.1
> >  SOAPAction: ""
> >  Content-Type: text/xml; charset=UTF-8
> >  User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; XFire
> >  Client +http://xfire.codehaus.org <http://xfire.codehaus.org/>)
> >  Host: localhost:8090
> >  Expect: 100-continue
> >  Content-Length: 589
> >
> >  <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> >  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> >  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soap:Body><logon
> >  xmlns="http://services.spp.singularity.com
> > <http://services.spp.singularity.com/>"><in0
> >  xmlns="http://services.spp.singularity.com
> > <http://services.spp.singularity.com/>*"><logonProtocol
> >  xmlns="**http://com.singularity.spp.to*
> > <http://com.singularity.spp.to/>*">1</logonProtocol><password
> >  xmlns="**http://com.singularity.spp.to*
> > <http://com.singularity.spp.to/>*" xsi:nil="true" /><unConditional
> >  xmlns="**http://com.singularity.spp.to*
> > <http://com.singularity.spp.to/>*">true</unConditional><userId
> >  xmlns="**http://com.singularity.spp.to*
> >
> <http://com.singularity.spp.to/>*">TEST</userId>*</in0></logon></soap:Body></soap:Envelope>
> >  ===============xfire client request -END====================
> > XSUL request is as below
> > 
> > <?xml version='1.0' encoding='utf-8'?><S:Envelope
> > xmlns:xsd='http://www.w3.org/2001/XMLSchema'
> <http://www.w3.org/2001/XMLSchema%27>
> > xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
> <http://www.w3.org/2001/XMLSchema-instance%27>
> > xmlns:wsa='http://www.w3.org/2005/08/addressing'
> <http://www.w3.org/2005/08/addressing%27>
> > xmlns:wsp='http://schemas.xmlsoap.org/ws/2002/12/policy'
> <http://schemas.xmlsoap.org/ws/2002/12/policy%27>
> > xmlns:S='http://schemas.xmlsoap.org/soap/envelope/'
> <http://schemas.xmlsoap.org/soap/envelope/%27>><S:Header><wsa:To>http://localhost:8089/sppj/services/PlatformManagerService</wsa:To></S:Header><S:Body><n1:logon
> > xmlns:n1='http://singularity.co.uk/webservices/spp'
> <http://singularity.co.uk/webservices/spp%27>><in0*><item>1</item><item
> >
> /><item>true</item><item>TEST</item>*</in0></n1:logon></S:Body></S:Envelope>
> >
> > I have added these *item* elements in the request by replacing the
> > below two lines of code of XsulDynamicInvoker
> > ==========================================
> >                 System.err.println(partName+"="+partValue);
> >                 in.setObjectPart(partName, partValue);
> > ==========================================
> >                  WITH below code....
> > =================================
> >                 String argstring = "";
> >                 for(int i = 2; i < args.length; i++) {
> >                     argstring= argstring+"<item>"+args[i]+"</item>";
> why do you put "item" here? put names of your elements i..e.
> "*<password>" etc or just commit this line above and it may also work
> *
> >                 }
> >                 XmlElement sarray =
> > builder.parseFragmentFromReader(new
> > StringReader("<"+partName+">"+argstring+"</"+partName+">"));
> >                 in.setObjectPart(partName, sarray);
> > =================================
> > 
> > Please let me know how to get the element names of the complex type as
> > done in XFire request.
> try both approaches and if it does not work i can show you how to set
> whole message content
>
> also please send me what is xfire error related to ws-addressing (if any)
>
> thanks,
>
> alek
> > 
> > regards,
> > Srinivas Velidanda.
> >
> > -----Original Message-----
> > From: Aleksander Slominski [mailto:aslom_at_cs.indiana.edu]
> > Sent: 11 May 2007 23:44
> > To: Velidanda Srinivas
> > Cc: xgws-user_at_cs.indiana.edu
> > Subject: Re: [xgws-user] Dynamic Invocation Error
> >
> >
> > hi,
> >
> > if you look into your WSDL you can see
> >
> > <wsdlsoap:operation soapAction=""/>
> >
> > so xsul was just mirroring that "" into <wsa:Action></wsa:Action> header
> > (as you noticed) and it seems xfire does nto like it ...
> >
> > so i changed it in xsul 2.10.2 (in CVS - see notif email in xgws-dev for
> > details of changes in XsulSoapOperation.java) to generate default
> > wsa:Action header derived from WSDL if soapAction==""
> >
> > i think that should fix the problem but let me know if it did not work
> > (XsulSoapOperation.java could be changed it to omit wsa:Action as well).
> >
> > thanks,
> >
> > alek
> >
> > Velidanda Srinivas wrote:
> > > Hi,
> > >
> > > I have downloaded and built xsul libraries and while executing
> > > xsul.dii.XsulDynamicInvoker.java I am getting the below soap fault.
> > >
> > > My web service is published using XFire and I am trying to consume
> using
> > > XSUL dynamic invoker client.
> > >
> > > Getting the below output
> > >
> > > ================================================
> > > Starting xsul.dii.XsulDynamicInvoker
> > > invoking operation 'logon' using WSDL from
> > > http://localhost:8081/sppj/services/PlatformManagerService?WSDL
> > > in0=1
> > > received fault <soap:Fault
> > >
> >
> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><faultcode>soap:Clien
> > > t</faultcode>
> > > <faultstring>Action '' was not found for service
> > >
> http://localhost:8081/sppj/services/PlatformManagerService</faultstring>
> > > </soap:Fault>
> > > ===============================================
> > > Please let me know how to fix this.
> > >
> > > thanks in advance,
> > > Srinivas.
> > >
> > >
> > >
> ________________________________________________________________________
> > > This e-mail has been scanned for all viruses by MessageLabs.
> > >
> > > Singularity operates globally through its offices in New York,
> > London, Singapore, Ireland and India. Singularity Limited is
> > incorporated in the United Kingdom with Registration Number NI 31519
> > and its Registered Office at 100 Patrick Street, Derry, BT48 7EL,
> > United Kingdom.
> > >
> ________________________________________________________________________
> > >
> > > _______________________________________________
> > > xgws-user mailing list
> > > xgws-user_at_cs.indiana.edu
> > > http://mailman.cs.indiana.edu/mailman/listinfo/xgws-user
> > > 
> >
> >
> > --
> > The best way to predict the future is to invent it - Alan Kay
> >
> >
> > ________________________________________________________________________
> > This e-mail has been scanned for all viruses by MessageLabs.
> > ________________________________________________________________________
> >
> > ________________________________________________________________________
> > This e-mail has been scanned for all viruses by MessageLabs.
> >
> > Singularity operates globally through its offices in New York, London,
> > Singapore, Ireland and India. Singularity Limited is incorporated in
> > the United Kingdom with Registration Number NI 31519 and its
> > Registered Office at 100 Patrick Street, Derry, BT48 7EL, United
> Kingdom.
> > ________________________________________________________________________
>
>
> --
> The best way to predict the future is to invent it - Alan Kay
>
>
> ________________________________________________________________________
> This e-mail has been scanned for all viruses by MessageLabs.
> ________________________________________________________________________
>
>
> ________________________________________________________________________
> This e-mail has been scanned for all viruses by MessageLabs.
>
> Singularity operates globally through its offices in New York, London,
> Singapore, Ireland and India. Singularity Limited is incorporated in
> the United Kingdom with Registration Number NI 31519 and its
> Registered Office at 100 Patrick Street, Derry, BT48 7EL, United Kingdom.
> ________________________________________________________________________


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