Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Web Service - Complex Types - Array Inside Array.  RSS feed

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everybody,


I am new to web service. I need to create a web Service in which i want to add a complex type inside another complex types. Below are the details of my classes..

[b]SMSContent.java[/b]

package com.inav.ws;

public class SMSContent
{
String content = "";
String ucpa_data_coding_id = "";
String ucpa_msg_class = "";
String ucpa_msg_type = "";


public String getContent() {
return content;
}

public void setContent(String content) {
this.content = content;
}

public String getUcpa_data_coding_id() {
return ucpa_data_coding_id;
}

public void setUcpa_data_coding_id(String ucpa_data_coding_id) {
this.ucpa_data_coding_id = ucpa_data_coding_id;
}

public String getUcpa_msg_class() {
return ucpa_msg_class;
}

public void setUcpa_msg_class(String ucpa_msg_class) {
this.ucpa_msg_class = ucpa_msg_class;
}

public String getUcpa_msg_type() {
return ucpa_msg_type;
}

public void setUcpa_msg_type(String ucpa_msg_type) {
this.ucpa_msg_type = ucpa_msg_type;
}
}




[b]SMSContentArray.java[/b]


package com.inav.ws;

public class SMSContentArray
{
SMSContent[] sms_content = new SMSContent[3];

public void SMSContentArray()
{

}

public void SMSContentArray(SMSContent[] sms_content)
{
this.sms_content = sms_content;
}

public SMSContent[] getSms_content() {
return sms_content;
}

public void setSms_content(SMSContent[] sms_content) {
this.sms_content = sms_content;
}


}


MyServices.java



package com.inav.ws;

public class CPServices
{
public void smsMo(String service_id, String source_mobtel, String sub_id, String keyword, SMSContentArray sms_contents[])
{
// Processing code here
}
}



I am Using Eclipse+tomcat 5.5+Axis 1.4 to generate web service



I generated the WSDL and i am using SOAPUI to test my webservice. When i import the WSDL to SOAPUI, the Request for the smsMO() method is as below:


<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.inav.com">
<soapenv:Header/>
<soapenv:Body>
<ws:smsMo>
<ws:service_id>?</ws:service_id>
<ws:source_mobtel>?</ws:source_mobtel>
<ws:sub_id>?</ws:sub_id>
<ws:keyword>?</ws:keyword>
<!--1 or more repetitions:-->
<ws:additional_info>
<ws:name>?</ws:name>
<ws:value>?</ws:value>
</ws:additional_info>
<!--1 or more repetitions:-->
<ws:sms_contents>
<ws:sms_content>
<!--Zero or more repetitions:-->
<ws:item>
<ws:content>?</ws:content>
<ws:ucpa_data_coding_id>?</ws:ucpa_data_coding_id>
<ws:ucpa_msg_class>?</ws:ucpa_msg_class>
<ws:ucpa_msg_type>?</ws:ucpa_msg_type>
</ws:item>
</ws:sms_content>
</ws:sms_contents>
</ws:smsMo>
</soapenv:Body>
</soapenv:Envelope>


But i need the SAOP Message format as below :

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.inav.com">
<soapenv:Header/>
<soapenv:Body>
<ws:smsMo>
<ws:service_id>?</ws:service_id>
<ws:source_mobtel>?</ws:source_mobtel>
<ws:sub_id>?</ws:sub_id>
<ws:keyword>?</ws:keyword>
<!--1 or more repetitions:-->
<ws:additional_info>
<ws:name>?</ws:name>
<ws:value>?</ws:value>
</ws:additional_info>
<!--1 or more repetitions:-->
<ws:sms_contents>
<!--Zero or more repetitions:-->
<ws:sms_content>
<ws:content>?</ws:content>
<ws:ucpa_data_coding_id>?</ws:ucpa_data_coding_id>
<ws:ucpa_msg_class>?</ws:ucpa_msg_class>
<ws:ucpa_msg_type>?</ws:ucpa_msg_type>
</ws:sms_content>
</ws:sms_contents>
</ws:smsMo>
</soapenv:Body>
</soapenv:Envelope>


inside the <ws:sms_contents> i need an array of <ws:sms_content>

But in the generated SOAP message from the WSDL inside <ws:sms_content> one more <ws:item> is coming..

Can anyone please help me to solve this problem.. I need to complete this WSDL with in Monday.. Please help me to get out of this problem..

Thanks in advance
Nagendra E Loli
 
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

public void smsMo(String service_id, String source_mobtel, String sub_id, String keyword, SMSContentArray sms_contents[])



<ws:item> is there to make room for multiple copies of SMSContentArray as that is defined as array in the web service method signature.

 
Nagendra E Loli
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Vinod K Singh wrote:

public void smsMo(String service_id, String source_mobtel, String sub_id, String keyword, SMSContentArray sms_contents[])



<ws:item> is there to make room for multiple copies of SMSContentArray as that is defined as array in the web service method signature.




Thanks a lot for the reply Vinod...

But can you please tell me how to retrieve the data inside <ws:item>. I dont have any implementations or any parameter or data type for the name "item".

And also my client want me to get the structure like the bleow:

<!--1 or more repetitions:-->
<ws:sms_contents>
<!--Zero or more repetitions:-->
<ws:sms_content>
<ws:content>?</ws:content>
<ws:ucpa_data_coding_id>?</ws:ucpa_data_coding_id>
<ws:ucpa_msg_class>?</ws:ucpa_msg_class>
<ws:ucpa_msg_type>?</ws:ucpa_msg_type>
</ws:sms_content>
</ws:sms_contents>

They want one <ws:sms_contents> complex type... then Inside that they want <ws:sms_content> complex type.. Inside <ws:sms_content> only my 4 parameters should reside...

But as i sent you the code, inside <ws:sms_content> one more <ws: item> is coming.. Because of this i am not able to receive any data for those 4 parameters...

Please help me to come out of this problem..
 
Vinod K Singh
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to create client side stubs to access the web service. Client side stubs should have necessary classes / methods to retrieve the objects being sent by the web service. I did not used Axis, you can have a look here to know how to create client and access the web service for JAX-WS>
 
Nagendra E Loli
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Vinod K Singh wrote:You need to create client side stubs to access the web service. Client side stubs should have necessary classes / methods to retrieve the objects being sent by the web service. I did not used Axis, you can have a look here to know how to create client and access the web service for JAX-WS>




I am not in need of Client Vinod. One Telecommuting company is my client.. They are sending the data for me.. For that i have to create the service like the format which i sent to you before..

If the 4 parameters wont come inside the <ws: sms_content> means i cant receive any data.. and i need the <ws: sms_content> array.. but i am not getting that array now.. Array is coming for <ws: item>

If you give your mail ID i can contact you directly.. My mail ID is nagendra.ge@gmail.com..

Please help me Vinod.. I need solution for this in urgent...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!