You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Rajnish Thakur <ra...@gmail.com> on 2014/01/16 11:39:21 UTC

Fwd: Fwd: Need Help Regarding AXIS2 Client Implementation

Hi,

Please somebody cab help me on issue below.

Regards,
Rajnish Thakur


---------- Forwarded message ----------
From: Rajnish Thakur <ra...@gmail.com>
Date: Mon, Jan 13, 2014 at 5:19 PM
Subject: Re: Fwd: Need Help Regarding AXIS2 Client Implementation
To: java-dev@axis.apache.org


Hi All,

PSB WSDL document that I used to generate stub using Wsdl2java tool. and
have attached Interface Create generated using tool that causing exception
in application.

[image: Inline image 1]

[image: Inline image 2]

Let me know if further details required.

Regards,
Rajnish Thakur

Regards,
Rajnish Thakur


On Sun, Jan 12, 2014 at 7:40 PM, Rajnish Thakur <ra...@gmail.com>wrote:

> Hi Deepal,
>
> Thanks for your reply on my question. as my service accepts xml payload in
> form of string and in wsdl there is no type define for objXML hence AXIS2
> automatically mapped it to OMElement type. another important note is
> wsdltojava tool map objXML parameter to OMElement in case of I am using ADB
> binding but when I generate stub using XMLBEAN databinding it map it as
> string.
>
> When I debug it I found the problem is due to serialization of objXML
> parameter as service expects sting and AXIS2 framework serialized objectXML
> using xmlstreamWriter hence exception comes out from AXIS2 core jar. This
> are my observations and assumption that I put here to understand the actual
> problem hope it helps let me know if you need any other details.
>
>
> Regards,
> Rajnish Thakur
>
>
> On Sat, Jan 11, 2014 at 11:29 PM, Deepal jayasinghe <de...@gmail.com>wrote:
>
>>  Not sure why you want to create an OMElement, what does the WSDL says
>> about the method signature ?
>>
>> Deepal
>>
>>      Hi,
>>
>>  Can you please help me? I have got stuck for last 4 days with AXIS2
>> client also have done lot of googling as well, but couldn't get help. This
>> is first time I am working with AXIS2. I have a .asmx service hosted over
>> IIS, I have generated stub using AXIS2 (WSDL2Java -uri
>> approvalrequestmanager.wsdl -p ne
>>  t.approva.BizRights.Services -d adb)
>>
>>  as well as have used below command and wrote client for both.
>>
>>  WSDL2Java -uri approvalrequestmanager.wsdl -p net.approva.BizRights.Services
>> -d xmlbeans -s
>>
>>  I have posted this on stackOverflow.com as well PSB link-
>>
>> http://stackoverflow.com/questions/20999991/exception-while-trying-to-execute-axis2-service-client
>>
>>  I have written client using generated stub from above command. In my
>> client code there is method which accepts two parameters one is kind of
>> string and another is kind of OMElement(XML).
>>
>>  When I try to send payload XML using code below:
>>
>>  Create req = new Create();
>>
>>              org.apache.axiom.om.OMFactory fac =
>> org.apache.axiom.om.OMAbstractFactory.getOMFactory();
>>             org.apache.axiom.om.OMNamespace omNs = fac.createOMNamespace("
>> http://www.approva.net/BizRights/Services", null);
>>
>>             org.apache.axiom.om.OMElement _valueObjXML =
>> fac.createOMElement("approvalrequests", omNs);
>>
>>             _valueObjXML.addChild(fac.createOMText(_valueObjXML,
>> content));
>>
>>             req.setObjXML(_valueObjXML);
>>
>>  req.setObjType(WellKnownType.ApprovalRequest);
>>
>>   res = stub.create(req, brSoapHeader);
>>
>>  *I got exception below:*
>>
>>  rg.apache.axis2.AxisFault: System.Web.Services.Protocols.SoapException:
>> Server was unable to process request. ---> System.InvalidCastException:
>> Unable to cast object of type 'System.Xml.XmlNode[]' to type
>> 'System.String'.
>>
>>  Looking at the exception my assumption is OMelement is getting passed
>> as XML type and and web service expecting string type so is there any way
>> to handle such situation in AXIS2.
>>
>>
>>  Thanks in advance..!!
>>
>>   Regards,
>> Rajnish Thakur
>>      Pune, INDIA
>>
>>
>>
>>
>>
>

Re: Fwd: Fwd: Need Help Regarding AXIS2 Client Implementation

Posted by Deepal Jayasinghe <de...@opensource.lk>.
Which means you are sending the wrong request, can use pass us the WSDL,
we can have a quick look at.

Deepal

> Hi,
>
> I have changed data-binding from ADB to XMLBeans while generating
> stubs i.e now I am using XMLbeans data binding so now I can pass
> payload XML as string to set operation of my service request so now
> I've got rid of OMElement but still I getting the same exception. any
> idea?
>
> Regards,
> Rajnish Thakur
>
>
> On Thu, Jan 16, 2014 at 10:19 PM, Deepal jayasinghe <deepalk@gmail.com
> <ma...@gmail.com>> wrote:
>
>     And if the wsdl says it needs an "objXML" as a method parameter,
>     then it should ready to take any XML. So, problem should be in the
>     service, if it needs a string then the service should specify that
>     in the WSDL.
>
>     One possible way to handle that would be is to get the working
>     version of the client and send it through TCP monitor and find the
>     correct message format that the service is asking for. Then create
>     the OMElement with that format.
>
>     Deepal
>>     Hi,
>>
>>     Please somebody cab help me on issue below.
>>      
>>     Regards,
>>     Rajnish Thakur
>>
>>
>>     ---------- Forwarded message ----------
>>     From: *Rajnish Thakur* <rajneesh.rt@gmail.com
>>     <ma...@gmail.com>>
>>     Date: Mon, Jan 13, 2014 at 5:19 PM
>>     Subject: Re: Fwd: Need Help Regarding AXIS2 Client Implementation
>>     To: java-dev@axis.apache.org <ma...@axis.apache.org>
>>
>>
>>     Hi All,
>>
>>     PSB WSDL document that I used to generate stub using Wsdl2java
>>     tool. and have attached Interface Create generated using tool
>>     that causing exception in application. 
>>
>>     Inline image 1
>>
>>     Inline image 2
>>
>>     Let me know if further details required.
>>
>>     Regards,
>>     Rajnish Thakur
>>
>>     Regards,
>>     Rajnish Thakur
>>
>>
>>     On Sun, Jan 12, 2014 at 7:40 PM, Rajnish Thakur
>>     <rajneesh.rt@gmail.com <ma...@gmail.com>> wrote:
>>
>>         Hi Deepal,
>>
>>         Thanks for your reply on my question. as my service accepts
>>         xml payload in form of string and in wsdl there is no type
>>         define for objXML hence AXIS2 automatically mapped it to
>>         OMElement type. another important note is wsdltojava tool map
>>         objXML parameter to OMElement in case of I am using ADB
>>         binding but when I generate stub using XMLBEAN databinding it
>>         map it as string.
>>
>>         When I debug it I found the problem is due to serialization
>>         of objXML parameter as service expects sting and AXIS2
>>         framework serialized objectXML using xmlstreamWriter hence
>>         exception comes out from AXIS2 core jar. This are my
>>         observations and assumption that I put here to understand the
>>         actual problem hope it helps let me know if you need any
>>         other details.
>>
>>
>>         Regards,
>>         Rajnish Thakur
>>
>>
>>         On Sat, Jan 11, 2014 at 11:29 PM, Deepal jayasinghe
>>         <deepalk@gmail.com <ma...@gmail.com>> wrote:
>>
>>             Not sure why you want to create an OMElement, what does
>>             the WSDL says about the method signature ?
>>
>>             Deepal
>>>             Hi,
>>>
>>>             Can you please help me? I have got stuck for last 4 days
>>>             with AXIS2 client also have done lot of googling as
>>>             well, but couldn't get help. This is first time I am
>>>             working with AXIS2. I have a .asmx service hosted over
>>>             IIS, I have generated stub using AXIS2 (WSDL2Java -uri
>>>             approvalrequestmanager.wsdl -p ne
>>>             t.approva.BizRights.Services -d adb)
>>>
>>>             as well as have used below command and wrote client for
>>>             both.
>>>
>>>             WSDL2Java -uri approvalrequestmanager.wsdl -p
>>>             net.approva.BizRights.Services -d xmlbeans -s
>>>
>>>             I have posted this on stackOverflow.com as well PSB link-
>>>             http://stackoverflow.com/questions/20999991/exception-while-trying-to-execute-axis2-service-client
>>>
>>>             I have written client using generated stub from above
>>>             command. In my client code there is method which accepts
>>>             two parameters one is kind of string and another is kind
>>>             of OMElement(XML).
>>>
>>>             When I try to send payload XML using code below:
>>>
>>>             Create req = new Create();
>>>
>>>                         org.apache.axiom.om.OMFactory fac =
>>>             org.apache.axiom.om.OMAbstractFactory.getOMFactory();
>>>                         org.apache.axiom.om.OMNamespace omNs =
>>>             fac.createOMNamespace("http://www.approva.net/BizRights/Services",
>>>             null);                                              
>>>                         org.apache.axiom.om.OMElement _valueObjXML =
>>>             fac.createOMElement("approvalrequests", omNs);          
>>>                                                  
>>>                        
>>>             _valueObjXML.addChild(fac.createOMText(_valueObjXML,
>>>             content));                   
>>>                        
>>>                         req.setObjXML(_valueObjXML);
>>>
>>>             req.setObjType(WellKnownType.ApprovalRequest);
>>>
>>>              res = stub.create(req, brSoapHeader);  
>>>
>>>             *I got exception below:*
>>>
>>>             rg.apache.axis2.AxisFault:
>>>             System.Web.Services.Protocols.SoapException: Server was
>>>             unable to process request. --->
>>>             System.InvalidCastException: Unable to cast object of
>>>             type 'System.Xml.XmlNode[]' to type 'System.String'.
>>>
>>>             Looking at the exception my assumption is OMelement is
>>>             getting passed as XML type and and web service expecting
>>>             string type so is there any way to handle such situation
>>>             in AXIS2.
>>>
>>>
>>>             Thanks in advance..!!
>>>
>>>             Regards,
>>>             Rajnish Thakur
>>>             Pune, INDIA
>>>
>>>
>>>
>>
>>
>>
>>
>>
>>
>>
>>     ---------------------------------------------------------------------
>>     To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org <ma...@axis.apache.org>
>>     For additional commands, e-mail: java-user-help@axis.apache.org <ma...@axis.apache.org>
>
>

-- 
Blog - http://blogs.deepal.org/

Re: Fwd: Fwd: Need Help Regarding AXIS2 Client Implementation

Posted by Rajnish Thakur <ra...@gmail.com>.
Hi,

I have changed data-binding from ADB to XMLBeans while generating stubs i.e
now I am using XMLbeans data binding so now I can pass payload XML as
string to set operation of my service request so now I've got rid of
OMElement but still I getting the same exception. any idea?

Regards,
Rajnish Thakur


On Thu, Jan 16, 2014 at 10:19 PM, Deepal jayasinghe <de...@gmail.com>wrote:

>  And if the wsdl says it needs an "objXML" as a method parameter, then it
> should ready to take any XML. So, problem should be in the service, if it
> needs a string then the service should specify that in the WSDL.
>
> One possible way to handle that would be is to get the working version of
> the client and send it through TCP monitor and find the correct message
> format that the service is asking for. Then create the OMElement with that
> format.
>
> Deepal
>
>  Hi,
>
>  Please somebody cab help me on issue below.
>
>  Regards,
> Rajnish Thakur
>
>
>  ---------- Forwarded message ----------
> From: Rajnish Thakur <ra...@gmail.com>
>  Date: Mon, Jan 13, 2014 at 5:19 PM
> Subject: Re: Fwd: Need Help Regarding AXIS2 Client Implementation
> To: java-dev@axis.apache.org
>
>
>   Hi All,
>
>  PSB WSDL document that I used to generate stub using Wsdl2java tool. and
> have attached Interface Create generated using tool that causing exception
> in application.
>
>  [image: Inline image 1]
>
>  [image: Inline image 2]
>
>  Let me know if further details required.
>
>  Regards,
> Rajnish Thakur
>
>  Regards,
> Rajnish Thakur
>
>
> On Sun, Jan 12, 2014 at 7:40 PM, Rajnish Thakur <ra...@gmail.com>wrote:
>
>> Hi Deepal,
>>
>>  Thanks for your reply on my question. as my service accepts xml payload
>> in form of string and in wsdl there is no type define for objXML hence
>> AXIS2 automatically mapped it to OMElement type. another important note is
>> wsdltojava tool map objXML parameter to OMElement in case of I am using ADB
>> binding but when I generate stub using XMLBEAN databinding it map it as
>> string.
>>
>>  When I debug it I found the problem is due to serialization of objXML
>> parameter as service expects sting and AXIS2 framework serialized objectXML
>> using xmlstreamWriter hence exception comes out from AXIS2 core jar. This
>> are my observations and assumption that I put here to understand the actual
>> problem hope it helps let me know if you need any other details.
>>
>>
>>  Regards,
>> Rajnish Thakur
>>
>>
>> On Sat, Jan 11, 2014 at 11:29 PM, Deepal jayasinghe <de...@gmail.com>wrote:
>>
>>>  Not sure why you want to create an OMElement, what does the WSDL says
>>> about the method signature ?
>>>
>>> Deepal
>>>
>>>      Hi,
>>>
>>>  Can you please help me? I have got stuck for last 4 days with AXIS2
>>> client also have done lot of googling as well, but couldn't get help. This
>>> is first time I am working with AXIS2. I have a .asmx service hosted over
>>> IIS, I have generated stub using AXIS2 (WSDL2Java -uri
>>> approvalrequestmanager.wsdl -p ne
>>>  t.approva.BizRights.Services -d adb)
>>>
>>>  as well as have used below command and wrote client for both.
>>>
>>>  WSDL2Java -uri approvalrequestmanager.wsdl -p net.approva.BizRights.Services
>>> -d xmlbeans -s
>>>
>>>  I have posted this on stackOverflow.com as well PSB link-
>>>
>>> http://stackoverflow.com/questions/20999991/exception-while-trying-to-execute-axis2-service-client
>>>
>>>  I have written client using generated stub from above command. In my
>>> client code there is method which accepts two parameters one is kind of
>>> string and another is kind of OMElement(XML).
>>>
>>>  When I try to send payload XML using code below:
>>>
>>>  Create req = new Create();
>>>
>>>              org.apache.axiom.om.OMFactory fac =
>>> org.apache.axiom.om.OMAbstractFactory.getOMFactory();
>>>             org.apache.axiom.om.OMNamespace omNs =
>>> fac.createOMNamespace("http://www.approva.net/BizRights/Services",
>>> null);
>>>             org.apache.axiom.om.OMElement _valueObjXML =
>>> fac.createOMElement("approvalrequests", omNs);
>>>
>>>             _valueObjXML.addChild(fac.createOMText(_valueObjXML,
>>> content));
>>>
>>>             req.setObjXML(_valueObjXML);
>>>
>>>  req.setObjType(WellKnownType.ApprovalRequest);
>>>
>>>   res = stub.create(req, brSoapHeader);
>>>
>>>  *I got exception below:*
>>>
>>>  rg.apache.axis2.AxisFault:
>>> System.Web.Services.Protocols.SoapException: Server was unable to process
>>> request. ---> System.InvalidCastException: Unable to cast object of type
>>> 'System.Xml.XmlNode[]' to type 'System.String'.
>>>
>>>  Looking at the exception my assumption is OMelement is getting passed
>>> as XML type and and web service expecting string type so is there any way
>>> to handle such situation in AXIS2.
>>>
>>>
>>>  Thanks in advance..!!
>>>
>>>   Regards,
>>> Rajnish Thakur
>>>      Pune, INDIA
>>>
>>>
>>>
>>>
>>>
>>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
>
>

Re: Fwd: Fwd: Need Help Regarding AXIS2 Client Implementation

Posted by Deepal jayasinghe <de...@gmail.com>.
And if the wsdl says it needs an "objXML" as a method parameter, then it
should ready to take any XML. So, problem should be in the service, if
it needs a string then the service should specify that in the WSDL.

One possible way to handle that would be is to get the working version
of the client and send it through TCP monitor and find the correct
message format that the service is asking for. Then create the OMElement
with that format.

Deepal
> Hi,
>
> Please somebody cab help me on issue below.
>  
> Regards,
> Rajnish Thakur
>
>
> ---------- Forwarded message ----------
> From: *Rajnish Thakur* <rajneesh.rt@gmail.com
> <ma...@gmail.com>>
> Date: Mon, Jan 13, 2014 at 5:19 PM
> Subject: Re: Fwd: Need Help Regarding AXIS2 Client Implementation
> To: java-dev@axis.apache.org <ma...@axis.apache.org>
>
>
> Hi All,
>
> PSB WSDL document that I used to generate stub using Wsdl2java tool.
> and have attached Interface Create generated using tool that causing
> exception in application. 
>
> Inline image 1
>
> Inline image 2
>
> Let me know if further details required.
>
> Regards,
> Rajnish Thakur
>
> Regards,
> Rajnish Thakur
>
>
> On Sun, Jan 12, 2014 at 7:40 PM, Rajnish Thakur <rajneesh.rt@gmail.com
> <ma...@gmail.com>> wrote:
>
>     Hi Deepal,
>
>     Thanks for your reply on my question. as my service accepts xml
>     payload in form of string and in wsdl there is no type define for
>     objXML hence AXIS2 automatically mapped it to OMElement type.
>     another important note is wsdltojava tool map objXML parameter to
>     OMElement in case of I am using ADB binding but when I generate
>     stub using XMLBEAN databinding it map it as string.
>
>     When I debug it I found the problem is due to serialization of
>     objXML parameter as service expects sting and AXIS2 framework
>     serialized objectXML using xmlstreamWriter hence exception comes
>     out from AXIS2 core jar. This are my observations and assumption
>     that I put here to understand the actual problem hope it helps let
>     me know if you need any other details.
>
>
>     Regards,
>     Rajnish Thakur
>
>
>     On Sat, Jan 11, 2014 at 11:29 PM, Deepal jayasinghe
>     <deepalk@gmail.com <ma...@gmail.com>> wrote:
>
>         Not sure why you want to create an OMElement, what does the
>         WSDL says about the method signature ?
>
>         Deepal
>>         Hi,
>>
>>         Can you please help me? I have got stuck for last 4 days with
>>         AXIS2 client also have done lot of googling as well, but
>>         couldn't get help. This is first time I am working with
>>         AXIS2. I have a .asmx service hosted over IIS, I have
>>         generated stub using AXIS2 (WSDL2Java -uri
>>         approvalrequestmanager.wsdl -p ne
>>         t.approva.BizRights.Services -d adb)
>>
>>         as well as have used below command and wrote client for both.
>>
>>         WSDL2Java -uri approvalrequestmanager.wsdl -p
>>         net.approva.BizRights.Services -d xmlbeans -s
>>
>>         I have posted this on stackOverflow.com as well PSB link-
>>         http://stackoverflow.com/questions/20999991/exception-while-trying-to-execute-axis2-service-client
>>
>>         I have written client using generated stub from above
>>         command. In my client code there is method which accepts two
>>         parameters one is kind of string and another is kind of
>>         OMElement(XML).
>>
>>         When I try to send payload XML using code below:
>>
>>         Create req = new Create();
>>
>>                     org.apache.axiom.om.OMFactory fac =
>>         org.apache.axiom.om.OMAbstractFactory.getOMFactory();
>>                     org.apache.axiom.om.OMNamespace omNs =
>>         fac.createOMNamespace("http://www.approva.net/BizRights/Services",
>>         null);                                              
>>                     org.apache.axiom.om.OMElement _valueObjXML =
>>         fac.createOMElement("approvalrequests", omNs);              
>>                                          
>>                    
>>         _valueObjXML.addChild(fac.createOMText(_valueObjXML,
>>         content));                   
>>                    
>>                     req.setObjXML(_valueObjXML);
>>
>>         req.setObjType(WellKnownType.ApprovalRequest);
>>
>>          res = stub.create(req, brSoapHeader);  
>>
>>         *I got exception below:*
>>
>>         rg.apache.axis2.AxisFault:
>>         System.Web.Services.Protocols.SoapException: Server was
>>         unable to process request. ---> System.InvalidCastException:
>>         Unable to cast object of type 'System.Xml.XmlNode[]' to type
>>         'System.String'.
>>
>>         Looking at the exception my assumption is OMelement is
>>         getting passed as XML type and and web service expecting
>>         string type so is there any way to handle such situation in
>>         AXIS2.
>>
>>
>>         Thanks in advance..!!
>>
>>         Regards,
>>         Rajnish Thakur
>>         Pune, INDIA
>>
>>
>>
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org