Hi Nigel,
When i consume this webservice on SoapUI and make a request for wsGetCity
through SoapUI, i observe a difference with the request body formed by
SoapUI tool and by Jibx.
SoapUI gives the following
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wst="http://travis.com/webservices/WSTicketvala/WSTicketvala"
xmlns:web="http://travis.com/webservices">
<soapenv:Header/>
<soapenv:Body>
<wst:wsGetCity>
<!--Optional:-->
<wst:wsGetCityRQ>
<!--Optional:-->
<web:wsAuthenticate>
<!--Optional:-->
<web:userId>faregugly</web:userId>
<!--Optional:-->
<web:groupId>1</web:groupId>
<!--Optional:-->
<web:password>faregugly@mmyt</web:password>
</web:wsAuthenticate>
</wst:wsGetCityRQ>
</wst:wsGetCity>
</soapenv:Body>
</soapenv:Envelope>
While Jibx-ws gives the following
<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP:Body><wsGetCity><wsGetCityRQ><wsAuthenticate><userId>faregugly</userId><groupId>1</groupId><password>faregugly@mmyt
</password></wsAuthenticate></wsGetCityRQ></wsGetCity>
</SOAP:Body></SOAP:Envelope>
where two attributes of <SOAP:envelope> are missing here.
xmlns:wst="http://travis.com/webservices/WSTicketvala/WSTicketvala"
xmlns:web="http://travis.com/webservices"
should be set in <SOAP:envelop> by jibx-ws.
Could you pls let me know how can i set these two missing attributes to
soap:envelop ?
Thanks
Deepak
On Tue, Mar 15, 2011 at 1:17 AM, Deepak Singh <deepaksingh...@gmail.com>wrote:
>
>
>
> Hi Nigel,
>>
>> The issue is still not resolved.
>>
>> Doing
>> List details = se.getFault().getDetails(); with catch block does not
>> produce anything as details.size() is zero.
>>
>> Also, i set interceptor as follows
>>
>> ByteArrayOutputStream request = new ByteArrayOutputStream(4096);
>> ByteArrayOutputStream response = new ByteArrayOutputStream(4096);
>> try{
>> String m_location = "
>> http://webservices.ticketvala.com/axis2/services/WSTicketvala";
>> IBindingFactory fac = BindingDirectory.getFactory(GetCityDetails.class);
>> SoapClient client = new SoapClient(m_location, fac);
>> client.setOperationName("urn:wsGetCity");
>> CopiedInputStreamInterceptor inputInterceptor = new
>> CopiedInputStreamInterceptor(response);
>> CopiedOutputStreamInterceptor outputInterceptor = new
>> CopiedOutputStreamInterceptor(request);
>> TransportOptions transportOptions =
>> TransportDirectory.newTransportOptions(m_location);
>> if(transportOptions instanceof OutputStreamInterceptable) {
>>
>> ((OutputStreamInterceptable)transportOptions).setOutputStreamInterceptor(outputInterceptor);
>> }
>> if(transportOptions instanceof InputStreamInterceptable) {
>>
>> ((InputStreamInterceptable)transportOptions).setInputStreamInterceptor(inputInterceptor);
>> }
>> client.setTransportOptions(transportOptions);
>> GetCityDetails city = new GetCityDetails();
>> Authenticate aut = new Authenticate();
>> aut.setGid("1");
>> aut.setPwd("faregugly@mmyt");
>> aut.setUid("faregugly");
>> city.setAuth(aut);
>> client.addInFaultDetailsHandler(new ExceptionReader());
>> /* client.setSoapFaultResolver(new SoapFaultResolver() {
>> @Override
>> public Object handleFault(SoapFault arg0) {
>> // System.out.println(arg0.getFaultCode().getUri());
>> return null;
>> }
>> });*/
>> Object obj = client.call(city);
>> }catch(SoapFaultException se) {
>> System.out.println("request "+request);
>> System.out.println("response "+response);
>> /*System.out.println("Error "+se.getFault()+" "+
>> se.getFault().getFaultString()+" "+se.getMessage()+
>> " "+se.getFault().getFaultCode().getUri()+" "+
>> se.getFault().getFaultCode().getName());*/
>> List details = se.getFault().getDetails();
>> if(details.size() > 0) {
>> System.out.println("details");
>> for(Iterator itr = details.iterator() ; itr.hasNext();) {
>> System.out.println(itr.next());
>> }
>> }
>> }catch(Exception e) {
>> e.printStackTrace();
>> }
>> }
>>
>> The above code produces following output
>>
>> request
>> <SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/
>> "><SOAP:Body><wsGetCity><wsGetCityRQ><wsAuthenticate><userId>faregugly</userId><groupId>1</groupId><password>faregugly@mmyt
>> </password></wsAuthenticate></wsGetCityRQ></wsGetCity></SOAP:Body></SOAP:Envelope>
>>
>> response
>> <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="
>> http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><soapenv:Fault><faultcode>soapenv:Server</faultcode><faultstring>unknown</faultstring><detail
>> /></soapenv:Fault></soapenv:Body></soapenv:Envelope>
>>
>> The exception throws at the line client.call(city). The request xml is
>> prepared well and all data are correct.
>>
>> Kindly help.
>>
>> Thanks
>> Deepak
>>
>> On Tue, Mar 15, 2011 at 12:13 AM, <
>> jibx-users-requ...@lists.sourceforge.net> wrote:
>>
>>> Send jibx-users mailing list submissions to
>>> jibx-users@lists.sourceforge.net
>>>
>>> To subscribe or unsubscribe via the World Wide Web, visit
>>> https://lists.sourceforge.net/lists/listinfo/jibx-users
>>> or, via email, send a message with subject or body 'help' to
>>> jibx-users-requ...@lists.sourceforge.net
>>>
>>> You can reach the person managing the list at
>>> jibx-users-ow...@lists.sourceforge.net
>>>
>>> When replying, please edit your Subject line so it is more specific
>>> than "Re: Contents of jibx-users digest..."
>>>
>>>
>>> Today's Topics:
>>>
>>> 1. Re: Starting Jibx (Nigel Charman)
>>>
>>>
>>> ----------------------------------------------------------------------
>>>
>>> Message: 1
>>> Date: Tue, 15 Mar 2011 07:42:48 +1300
>>> From: Nigel Charman <nigel.charman...@gmail.com>
>>> Subject: Re: [jibx-users] Starting Jibx
>>> To: JiBX users <jibx-users@lists.sourceforge.net>
>>> Message-ID: <4d7e61a8.6050...@gmail.com>
>>> Content-Type: text/plain; charset="utf-8"
>>>
>>> Hi Deepak
>>>
>>> Please try the following within the SoapFaultException catch block
>>> (copied from the soap-fault-trace example):
>>>
>>> System.err.println("SOAP Fault");
>>> System.err.println("----------");
>>> System.err.println(e.getFault());
>>> List details = se.getFault().getDetails();
>>> if (details.size()> 0) {
>>> System.err.println();
>>> System.err.println("Details");
>>> System.err.println("-------");
>>> for (Iterator iterator = details.iterator();
>>> iterator.hasNext();) {
>>> System.err.println(iterator.next());
>>> }
>>> }
>>>
>>> If you want to use a custom SoapFaultResolver, you will need to call
>>> client.setSoapFaultResolver(...) before calling client.call(city).
>>>
>>> If this doesn't help, you'll need to get a copy of the request and
>>> response messages for further diagnosis. You can do this by either:
>>>
>>> 1. Using JiBX/WS interceptors - see example [1], or
>>> 2. Using a monitoring proxy, such as Apache TCPMon
>>>
>>> cheers
>>> Nigel
>>>
>>> [1]
>>>
>>> http://jibx.svn.sourceforge.net/viewvc/jibx/jibxws/trunk/examples/http-servlet-interceptor/build/src/org/jibx/ws/example/interceptor/client/HelloClient.java?revision=450&content-type=text%2Fplain
>>>
>>>
>>> On 15/03/11 07:14, Deepak Singh wrote:
>>> > Hi Nigel,
>>> >
>>> > Changing the code as suggested by you again produces
>>> > SoapFaultException. Details as follows,
>>> >
>>> > try{
>>> > IBindingFactory fac =
>>> BindingDirectory.getFactory(GetCityDetails.class);
>>> > SoapClient client = new
>>> > SoapClient("
>>> http://webservices.ticketvala.com/axis2/services/WSTicketvala",
>>> > fac);
>>> > client.setOperationName("urn:wsGetCity");
>>> > GetCityDetails city = new GetCityDetails();
>>> > Authenticate aut = new Authenticate();
>>> > aut.setGid("1");
>>> > aut.setPwd("faregugly@mmyt");
>>> > aut.setUid("faregugly");
>>> > city.setAuth(aut);
>>> > client.addInFaultDetailsHandler(new ExceptionReader());
>>> > Line 31- Object obj = client.call(city);
>>> > client.setSoapFaultResolver(new SoapFaultResolver() {
>>> > @Override
>>> > public Object handleFault(SoapFault arg0) {
>>> > System.out.println(arg0.getFaultCode().getUri());
>>> > return null;
>>> > }
>>> > });
>>> > }catch(SoapFaultException se) {
>>> > System.out.println("Error "+se.getFault()+"
>>> > "+se.getFault().getFaultString()+" "+se.getMessage());
>>> > se.printStackTrace();
>>> > }catch(Exception e) {
>>> > e.printStackTrace();
>>> > }
>>> > }
>>> >
>>> > Running this program produces the following output
>>> >
>>> > Error soapenv:Server - unknown unknown unknown
>>> > org.jibx.ws.soap.SoapFaultException: unknown
>>> > at org.jibx.ws.soap.client.SoapClient.handleFault(SoapClient.java:428)
>>> > at org.jibx.ws.soap.client.SoapClient.call(SoapClient.java:418)
>>> > at com.jibx.gwt.shared.TestJibx.main(TestJibx.java:31)
>>> >
>>> > Kindly suggest how to resolve this.
>>> >
>>> > Thanks
>>> > Deepak
>>> >
>>> >
>>> >
>>> > On Mon, Mar 14, 2011 at 1:36 PM,
>>> > <jibx-users-requ...@lists.sourceforge.net
>>> > <mailto:jibx-users-requ...@lists.sourceforge.net>> wrote:
>>> >
>>> > Send jibx-users mailing list submissions to
>>> > jibx-users@lists.sourceforge.net
>>> > <mailto:jibx-users@lists.sourceforge.net>
>>> >
>>> > To subscribe or unsubscribe via the World Wide Web, visit
>>> > https://lists.sourceforge.net/lists/listinfo/jibx-users
>>> > or, via email, send a message with subject or body 'help' to
>>> > jibx-users-requ...@lists.sourceforge.net
>>> > <mailto:jibx-users-requ...@lists.sourceforge.net>
>>> >
>>> > You can reach the person managing the list at
>>> > jibx-users-ow...@lists.sourceforge.net
>>> > <mailto:jibx-users-ow...@lists.sourceforge.net>
>>> >
>>> > When replying, please edit your Subject line so it is more specific
>>> > than "Re: Contents of jibx-users digest..."
>>> >
>>> >
>>> > Today's Topics:
>>> >
>>> > 1. Re: Starting Jibx (Nigel Charman)
>>> >
>>> >
>>> >
>>> ----------------------------------------------------------------------
>>> >
>>> > Message: 1
>>> > Date: Mon, 14 Mar 2011 21:05:55 +1300
>>> > From: Nigel Charman <nigel.charman.nz
>>> > <http://nigel.charman.nz>@gmail.com <http://gmail.com>>
>>> > Subject: Re: [jibx-users] Starting Jibx
>>> > To: JiBX users <jibx-users@lists.sourceforge.net
>>> > <mailto:jibx-users@lists.sourceforge.net>>
>>> > Message-ID: <4d7dcc63.90...@gmail.com
>>> > <mailto:4d7dcc63.90...@gmail.com>>
>>> > Content-Type: text/plain; charset="utf-8"
>>> >
>>> > Hi Deepak
>>> >
>>> > Since this is a SOAP service, you should use SoapClient rather than
>>> > PoxClient. The POX interface simply transports Plain Old XML
>>> payloads
>>> > without the additional SOAP constructs (see
>>> > http://jibx.sourceforge.net/jibxws/pox.html).
>>> >
>>> > The following WSDL implies that the SOAP service is requiring a
>>> > SOAPAction header set to "urn:wsGetCity".
>>> >
>>> > <wsdl:operation name="wsGetCity">
>>> > <wsdl:input message="tns:wsGetCityMessage"
>>> > wsaw:Action="urn:wsGetCity"/>
>>> >
>>> > To set this header, you'll need to change your code from:
>>> >
>>> > Client client = new
>>> > PoxClient("
>>> http://webservices.ticketvala.com/axis2/services/WSTicketvala",
>>> > fac);
>>> > ...
>>> >
>>> > to
>>> >
>>> > SoapClient client = new
>>> > SoapClient("
>>> http://webservices.ticketvala.com/axis2/services/WSTicketvala",
>>> > fac);
>>> > client.setOperationName("urn:wsGetCity");
>>> > ...
>>> >
>>> > If this still fails with a SOAPFault, catch the SoapFaultException
>>> and
>>> > call getFault() and getMessage() for details of the fault.
>>> >
>>> > cheers
>>> > Nigel
>>> >
>>> > On 14/03/11 09:50, Deepak Singh wrote:
>>> > > Hi Dennis,
>>> > >
>>> > > I downloaded the latest jibx-ws-0.9.1 and tried my webservices
>>> with
>>> > > this one. Details is as follows,
>>> > >
>>> > > I have a wsdl file at
>>> > >
>>> http://webservices.ticketvala.com/axis2/services/WSTicketvala?wsdl
>>> > > Pls hit the url above to see the wsdl file. here there are
>>> different
>>> > > methods to invoke. I try with single method wsGetCity.
>>> > >
>>> > > I need to invoke this method to get the response. Xml for
>>> > request and
>>> > > response is as follows,
>>> > >
>>> > > request.xml
>>> > >
>>> > > <wsGetCity>
>>> > >
>>> > > **
>>> > >
>>> > > <wsGetCityRQ>
>>> > >
>>> > > <wsAuthenticate>
>>> > >
>>> > > <userId>xyz</userId>
>>> > >
>>> > > <groupId>1</groupId>
>>> > >
>>> > > <password>xyz</password>
>>> > >
>>> > > </wsAuthenticate>
>>> > >
>>> > > </wsGetCityRQ>
>>> > >
>>> > > </wsGetCity>
>>> > >
>>> > >
>>> > > similarly response.xml has its own format.
>>> > >
>>> > >
>>> > > I created datamodel and binding file for request.xml as follows,
>>> > >
>>> > > public class GetCityDetails {
>>> > >
>>> > > public GetCityDetails() {
>>> > >
>>> > > }
>>> > >
>>> > > private Authenticate auth;
>>> > >
>>> > >
>>> > > public Authenticate getAuth() {
>>> > >
>>> > > return auth;
>>> > >
>>> > > }
>>> > >
>>> > >
>>> > > public void setAuth(Authenticate auth) {
>>> > >
>>> > > this.auth = auth;
>>> > >
>>> > > }
>>> > >
>>> > > }
>>> > >
>>> > >
>>> > > public class Authenticate {
>>> > >
>>> > >
>>> > > public Authenticate() {
>>> > >
>>> > >
>>> > > }
>>> > >
>>> > >
>>> > > private String uid;
>>> > >
>>> > > private String gid;
>>> > >
>>> > > private String pwd;
>>> > >
>>> > > public String getUid() {
>>> > >
>>> > > return uid;
>>> > >
>>> > > }
>>> > >
>>> > > public void setUid(String uid) {
>>> > >
>>> > > this.uid = uid;
>>> > >
>>> > > }
>>> > >
>>> > > public String getGid() {
>>> > >
>>> > > return gid;
>>> > >
>>> > > }
>>> > >
>>> > > public void setGid(String gid) {
>>> > >
>>> > > this.gid = gid;
>>> > >
>>> > > }
>>> > >
>>> > > public String getPwd() {
>>> > >
>>> > > return pwd;
>>> > >
>>> > > }
>>> > >
>>> > > public void setPwd(String pwd) {
>>> > >
>>> > > this.pwd = pwd;
>>> > >
>>> > > }Exception
>>> > >
>>> > > }
>>> > >
>>> > >
>>> > > binding.xml
>>> > >
>>> > > <?xml version="1.0" encoding="UTF-8"?>
>>> > >
>>> > > <binding>
>>> > >
>>> > > <mapping name="wsGetCity"
>>> class="com.jibx.gwt.shared.GetCityDetails"
>>> > > ordered="false">
>>> > >
>>> > > <structure name="wsGetCityRQ" usage="optional">
>>> > >
>>> > > <structure name="wsAuthenticate" field="auth" usage="optional">
>>> > >
>>> > > <value name="userId" field="uid" usage="optional"></value>
>>> > >
>>> > > <value name="groupId" field="gid" usage="optional"></value>
>>> > >
>>> > > <value name="password" field="pwd" usage="optional"></value>
>>> > >
>>> > > </structure>
>>> > >
>>> > > </structure>
>>> > >
>>> > > </mapping>
>>> > >
>>> > > </binding>
>>> > >
>>> > >
>>> > > I run the jibx compiler jibx 1.2.2 as eclipse plugin and
>>> compilation
>>> > > successful.
>>> > >
>>> > >
>>> > > Now i create the client to invoke the method wsGetCity
>>> > >
>>> > >
>>> > > IBindingFactory fac =
>>> > BindingDirectory.getFactory(GetCityDetails.class);
>>> > >
>>> > > Client client = new
>>> > >
>>> > PoxClient("
>>> http://webservices.ticketvala.com/axis2/services/WSTicketvala",
>>> > > fac);
>>> > >
>>> > > GetCityDetails city = new GetCityDetails();
>>> > >
>>> > > Authenticate aut = new Authenticate();
>>> > >
>>> > > aut.setGid("1");
>>> > >
>>> > > aut.setPwd("faregugly@mmyt");
>>> > >
>>> > > aut.setUid("faregugly");
>>> > >
>>> > > city.setAuth(aut);
>>> > >
>>> > > client.call(city);
>>> > >
>>> > >
>>> > > Now at the last line, client.call(city), i get the exception as
>>> > > org.jibx.ws.transport.WsTransportException: 500 Internal Server
>>> > Error
>>> > >
>>> > > I tried with SoapClient also but got SoapFault exception.
>>> > >
>>> > > Kindly request you to find out my mistake. Am i passing correct
>>> > url to
>>> > > PoxClient ?
>>> > >
>>> > > Also, is this the correct way to consume webservice methods at
>>> > client
>>> > > side?
>>> > >
>>> > > Kindly explain the concept a bit.
>>> > >
>>> > > Thanks
>>> > > Deepak
>>>
>>
>
------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users