Axis2c new user - xs:anyType issue

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Axis2c new user - xs:anyType issue

Pavani J
Hi,

I have WSDL generated C stubs and using axis2c-1.7.0 to deploy web services. I am on server side.

I am stuck at generating axiom node for xs:anyType. Below is my WSDL for that.


<xs:complexType name="SomeInfo" xmlns:ax213="http://data.some.abcd.com/xsd">
                <xs:sequence>
                    <xs:element minOccurs="0" name="name1" type="xs:boolean"/>
                    <xs:element minOccurs="0" name="name2" type="xs:boolean"/>
                    <xs:element minOccurs="0" name="error" nillable="true" type="xs:anyType"/>
                    <xs:element minOccurs="0" name="name3" nillable="true" type="xs:dateTime"/>
                    <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
                    <xs:element minOccurs="0" name="progress" type="xs:int"/>
                    <xs:element minOccurs="0" name="name4" type="xs:boolean"/>
                    <xs:element minOccurs="0" name="result" nillable="true" type="xs:anyType"/> <---- I am interested in result
                    <xs:element minOccurs="0" name="name5" nillable="true" type="xs:dateTime"/>
                    <xs:element minOccurs="0" name="name6" nillable="true" type="xs:string"/>
                    <xs:element minOccurs="0" name="name7" nillable="true" type="xs:string"/>
                </xs:sequence>
            </xs:complexType>

In C generated code, result is a node. In my code result could be a structure like below or could be a list of some other structure.
                                   
            <xs:complexType name="SomeResult" xmlns:ax213="http://data.some.abcd.com/xsd">
                   <xs:sequence>
                       <xs:element minOccurs="0" name="pInfo" nillable="true" type="ax211:VVInfo"/>
                       <xs:element minOccurs="0" name="pStats" nillable="true" type="ax211:SStats"/>
                       <xs:element minOccurs="0" name="sId" nillable="true" type="xs:string"/>
                   </xs:sequence>
            </xs:complexType>

Now my question is how to create a result node out of SomeResult structure?
If this kind of question is already answered, please point me the link.
            
I greatly appreciate your help.

Thanks is advance.
Pavani
Reply | Threaded
Open this post in threaded view
|

Re: Axis2c new user - xs:anyType issue

Dimuthu Gamage
If the type of the element is xs:anyType, WSDL2C will generate an
axiom node for that element.

Possible solution is to change the "xs:anyType" to "tns:SomeResult" in
your WSDL. Here the "tns" should be defined as a prefix for the target
namespace of "SomeResult".

Thanks
Dimuthu

On Thu, May 2, 2013 at 4:49 PM, Pavani J <[hidden email]> wrote:

> Hi,
>
> I have WSDL generated C stubs and using axis2c-1.7.0 to deploy web services.
> I am on server side.
>
> I am stuck at generating axiom node for xs:anyType. Below is my WSDL for
> that.
>
>
> <xs:complexType name="SomeInfo" xmlns:ax213="http://data.some.abcd.com/xsd">
>                 <xs:sequence>
>                     <xs:element minOccurs="0" name="name1"
> type="xs:boolean"/>
>                     <xs:element minOccurs="0" name="name2"
> type="xs:boolean"/>
>                     <xs:element minOccurs="0" name="error" nillable="true"
> type="xs:anyType"/>
>                     <xs:element minOccurs="0" name="name3" nillable="true"
> type="xs:dateTime"/>
>                     <xs:element minOccurs="0" name="name" nillable="true"
> type="xs:string"/>
>                     <xs:element minOccurs="0" name="progress"
> type="xs:int"/>
>                     <xs:element minOccurs="0" name="name4"
> type="xs:boolean"/>
>                     <xs:element minOccurs="0" name="result" nillable="true"
> type="xs:anyType"/> <---- I am interested in result
>                     <xs:element minOccurs="0" name="name5" nillable="true"
> type="xs:dateTime"/>
>                     <xs:element minOccurs="0" name="name6" nillable="true"
> type="xs:string"/>
>                     <xs:element minOccurs="0" name="name7" nillable="true"
> type="xs:string"/>
>                 </xs:sequence>
>             </xs:complexType>
>
> In C generated code, result is a node. In my code result could be a
> structure like below or could be a list of some other structure.
>
>             <xs:complexType name="SomeResult"
> xmlns:ax213="http://data.some.abcd.com/xsd">
>                    <xs:sequence>
>                        <xs:element minOccurs="0" name="pInfo"
> nillable="true" type="ax211:VVInfo"/>
>                        <xs:element minOccurs="0" name="pStats"
> nillable="true" type="ax211:SStats"/>
>                        <xs:element minOccurs="0" name="sId" nillable="true"
> type="xs:string"/>
>                    </xs:sequence>
>             </xs:complexType>
>
> Now my question is how to create a result node out of SomeResult structure?
> If this kind of question is already answered, please point me the link.
>
> I greatly appreciate your help.
>
> Thanks is advance.
> Pavani

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Axis2c new user - xs:anyType issue

Pavani J
Thank you for quick response.

The problem is, result could be of type "SomeResult" or "SomeOtherResult" or just a string, it can be know only before creating "SomeInfo" ADB object using adb_SomeInfo_create_with_values().  I need to create result node from one of the above listed types and pass that result node to adb_SomeInfo_create_with_values().

Now how should I create result node (of type anyType) from either "SomeResult" or "SomeOtherResult"? 
I already know how to create node from string.

And also I changing WSDL is not an option for my project.

I greatly appreciate your help.
Thanks in advance for all your help.

Pavani



On Thu, May 2, 2013 at 7:23 PM, Dimuthu Gamage <[hidden email]> wrote:
If the type of the element is xs:anyType, WSDL2C will generate an
axiom node for that element.

Possible solution is to change the "xs:anyType" to "tns:SomeResult" in
your WSDL. Here the "tns" should be defined as a prefix for the target
namespace of "SomeResult".

Thanks
Dimuthu

On Thu, May 2, 2013 at 4:49 PM, Pavani J <[hidden email]> wrote:
> Hi,
>
> I have WSDL generated C stubs and using axis2c-1.7.0 to deploy web services.
> I am on server side.
>
> I am stuck at generating axiom node for xs:anyType. Below is my WSDL for
> that.
>
>
> <xs:complexType name="SomeInfo" xmlns:ax213="http://data.some.abcd.com/xsd">
>                 <xs:sequence>
>                     <xs:element minOccurs="0" name="name1"
> type="xs:boolean"/>
>                     <xs:element minOccurs="0" name="name2"
> type="xs:boolean"/>
>                     <xs:element minOccurs="0" name="error" nillable="true"
> type="xs:anyType"/>
>                     <xs:element minOccurs="0" name="name3" nillable="true"
> type="xs:dateTime"/>
>                     <xs:element minOccurs="0" name="name" nillable="true"
> type="xs:string"/>
>                     <xs:element minOccurs="0" name="progress"
> type="xs:int"/>
>                     <xs:element minOccurs="0" name="name4"
> type="xs:boolean"/>
>                     <xs:element minOccurs="0" name="result" nillable="true"
> type="xs:anyType"/> <---- I am interested in result
>                     <xs:element minOccurs="0" name="name5" nillable="true"
> type="xs:dateTime"/>
>                     <xs:element minOccurs="0" name="name6" nillable="true"
> type="xs:string"/>
>                     <xs:element minOccurs="0" name="name7" nillable="true"
> type="xs:string"/>
>                 </xs:sequence>
>             </xs:complexType>
>
> In C generated code, result is a node. In my code result could be a
> structure like below or could be a list of some other structure.
>
>             <xs:complexType name="SomeResult"
> xmlns:ax213="http://data.some.abcd.com/xsd">
>                    <xs:sequence>
>                        <xs:element minOccurs="0" name="pInfo"
> nillable="true" type="ax211:VVInfo"/>
>                        <xs:element minOccurs="0" name="pStats"
> nillable="true" type="ax211:SStats"/>
>                        <xs:element minOccurs="0" name="sId" nillable="true"
> type="xs:string"/>
>                    </xs:sequence>
>             </xs:complexType>
>
> Now my question is how to create a result node out of SomeResult structure?
> If this kind of question is already answered, please point me the link.
>
> I greatly appreciate your help.
>
> Thanks is advance.
> Pavani

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: Axis2c new user - xs:anyType issue

Thomas Baier-2
Pavani,

I have implemented this by hand without ADB. I can now successfully
return any data types (including arrays of any types). When getting
anyType parameters, things are getting more complicated as the two
client frameworks I've been tested against (Java and .NET) do not agree
on how to pass arrays of anyType.

What I did was more or less:

axiom_node_t* axis2_skel_StatConnector_XXX(const axutil_env_t *env,
                                                 axiom_node_t* _xXX )
{
  axiom_node_t* lResNode = NULL;
  axiom_element_t *lResponse = NULL;
  axiom_attribute_t *lAtt = NULL;
  axiom_element_t *lCurrentElement = NULL;

  lResponse = axiom_element_create(env,NULL,"XXXResponse",
                                   getNS(env),&lResNode);
  lAtt = axiom_attribute_create(env,"xmlns:xsd",
                                "http://www.w3.org/2001/XMLSchema",NULL);
  axiom_element_add_attribute(lResponse,env,lAtt,lResNode);
  lCurrentElement = axiom_element_create(env,
        lResNode,"XXXResult",
         getNSStatConn(env),&lCurrentNode);
  XXX2axiom_node(lCurrentNode,env);
  return lResNode;
}

The real result is produced in XCXX2axiom_node().

Maybe there is also some way to do this easier with ADB yet, but for me
my code is working :)

Best,
Thomas

On 03.05.2013 05:54, Pavani J wrote:

> Thank you for quick response.
>
> The problem is, result could be of type "SomeResult" or
> "SomeOtherResult" or just a string, it can be know only before creating
> "SomeInfo" ADB object using adb_SomeInfo_create_with_values().  I need
> to create result node from one of the above listed types and pass that
> result node to adb_SomeInfo_create_with_values().
>
> Now how should I create result node (of type anyType) from either
> "SomeResult" or "SomeOtherResult"?
> I already know how to create node from string.
>
> And also I changing WSDL is not an option for my project.
>
> I greatly appreciate your help.
> Thanks in advance for all your help.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Axis2c new user - xs:anyType issue

Pavani J
Hi Thomas,

My apologies if I am asking a dumb question.
Is XCCC2axiom_node() / XXX2axiom_node() from axis2c code or something you wrote?
If it is in axis2c source code could you please point me the location.
If it is not, could you explain how you got real result from that API.

Thanks in advance.
Pavani


On Thu, May 2, 2013 at 10:46 PM, Thomas Baier <[hidden email]> wrote:
Pavani,

I have implemented this by hand without ADB. I can now successfully
return any data types (including arrays of any types). When getting
anyType parameters, things are getting more complicated as the two
client frameworks I've been tested against (Java and .NET) do not agree
on how to pass arrays of anyType.

What I did was more or less:

axiom_node_t* axis2_skel_StatConnector_XXX(const axutil_env_t *env,
                                                 axiom_node_t* _xXX )
{
  axiom_node_t* lResNode = NULL;
  axiom_element_t *lResponse = NULL;
  axiom_attribute_t *lAtt = NULL;
  axiom_element_t *lCurrentElement = NULL;

  lResponse = axiom_element_create(env,NULL,"XXXResponse",
                                   getNS(env),&lResNode);
  lAtt = axiom_attribute_create(env,"xmlns:xsd",
                                "http://www.w3.org/2001/XMLSchema",NULL);
  axiom_element_add_attribute(lResponse,env,lAtt,lResNode);
  lCurrentElement = axiom_element_create(env,
        lResNode,"XXXResult",
         getNSStatConn(env),&lCurrentNode);
  XXX2axiom_node(lCurrentNode,env);
  return lResNode;
}

The real result is produced in XCXX2axiom_node().

Maybe there is also some way to do this easier with ADB yet, but for me
my code is working :)

Best,
Thomas

On 03.05.2013 05:54, Pavani J wrote:
> Thank you for quick response.
>
> The problem is, result could be of type "SomeResult" or
> "SomeOtherResult" or just a string, it can be know only before creating
> "SomeInfo" ADB object using adb_SomeInfo_create_with_values().  I need
> to create result node from one of the above listed types and pass that
> result node to adb_SomeInfo_create_with_values().
>
> Now how should I create result node (of type anyType) from either
> "SomeResult" or "SomeOtherResult"?
> I already know how to create node from string.
>
> And also I changing WSDL is not an option for my project.
>
> I greatly appreciate your help.
> Thanks in advance for all your help.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: Axis2c new user - xs:anyType issue

Thomas Baier-2
On 03.05.2013 08:46, Pavani J wrote:
> Hi Thomas,
>
> My apologies if I am asking a dumb question.
> Is XCCC2axiom_node() / XXX2axiom_node() from axis2c code or something
> you wrote?
Yes. Sorry, there was a typo below. There is only a single function
XXX2axiom_node() which builds the result code.

I am using axiom_element_create() to create the XML elements and I'm
creating the XML texts on my own and allocating using axiom_text_create().

To find out how to do it I first created functions returning concrete
types, not anyType and then I looked at the generated code to find out
what was needed.

Thomas

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Axis2c new user - xs:anyType issue

Pavani J
Thanks Thomas. I will give it a try.

Regards,
Pavani


On Thu, May 2, 2013 at 11:55 PM, Thomas Baier <[hidden email]> wrote:
On 03.05.2013 08:46, Pavani J wrote:
> Hi Thomas,
>
> My apologies if I am asking a dumb question.
> Is XCCC2axiom_node() / XXX2axiom_node() from axis2c code or something
> you wrote?
Yes. Sorry, there was a typo below. There is only a single function
XXX2axiom_node() which builds the result code.

I am using axiom_element_create() to create the XML elements and I'm
creating the XML texts on my own and allocating using axiom_text_create().

To find out how to do it I first created functions returning concrete
types, not anyType and then I looked at the generated code to find out
what was needed.

Thomas

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]