Publish ColdFusion Web Service with Complex Return Type

Hi,
I am working on a project to publish couple ColdFusion
webservices. The cosumer of those webservices is a Java
application.
One of my webservice need return an object. Here are demo
codes:
The returned ojbect is AddressRespond
AddressRespond.cfc:
<cfcomponent>
<cfproperty name="addresses" type="Address[]" />
<cfproperty name="myLearnException" type="MyException"
/>
</cfcomponent>
Address.cfc:
<cfcomponent>
<cfproperty name="city" type="string" />
<cfproperty name="state" type="string" />
</cfcomponent>
MyException.cfc:
<cfcomponent>
<cfproperty name="code" type="string" />
<cfproperty name="reason" type="string" />
</cfcomponent>
If the webservice "cosumer" is a ColdFusion application,
there is no any problems. But the Java application doesn't
understand the type of addresses in the WSDL file which is
gernerated by ColdFusion:
<complexType name="Address">
<sequence>
<element name="city" nillable="true"
type="xsd:string"/>
<element name="state" nillable="true"
type="xsd:string"/>
</sequence>
</complexType>
<complexType name="MyException">
<sequence>
<element name="code" nillable="true"
type="xsd:string"/>
<element name="reason" nillable="true"
type="xsd:string"/>
</sequence>
</complexType>
<complexType name="AddressRespond">
<sequence>
<element name="addresses" nillable="true"
type="tns1:ArrayOf_xsd_anyType"/>
<element name="MyException" nillable="true"
type="impl:MyException"/>
</sequence>
</complexType>
Could anybody give me any idea on how to resolve this
problem?
Thanks!

The web service is actually the function, not the cfc and you
didn't show a function.
My own opinion is that since webservices by definition should
be available to any calling app (cold fusion, .net, flash, etc),
whatever gets returned from the method should be as universally
recognizable as possible. This generally means text, numbers,
boolean, or xml.

Similar Messages

  • Consuming Java Web Service with complex return types

    Hi,
    I'm consuming a Java Web Service and the return I get in
    ColdFusion is a typed Java Object (with custom Java classes like
    com.company.project.JavaClass ...)
    Within this object I don't get direct accessible properties
    as when I'm consuming ColdFusion Web Services, instead I get a
    getPROPERTYNAME and setPROPERTYNAME method for each property.
    How can I handle this? I don't want to call this methods for
    each property (and there are nested objects with arrays of custom
    classes below, which would really make this complicated).
    What's the best way to cope up with this?
    Thanks a lot,
    Fritz

    The web service is actually the function, not the cfc and you
    didn't show a function.
    My own opinion is that since webservices by definition should
    be available to any calling app (cold fusion, .net, flash, etc),
    whatever gets returned from the method should be as universally
    recognizable as possible. This generally means text, numbers,
    boolean, or xml.

  • EJB3 Creating Web Services with Complex Return Types

    Hi
    Not sure if this is the right place, but hoping someone can help!
    I have an entity bean that has a collection (list<Address>) of sub-entities. I have then created a session bean to retrieve the Business and populate it's children.
    I then expose this as a web service and although it works and I get appropriate XML out, the WSDL of the deployed service is not as I would like.
    For example:
    The return type is
    <complextype name="Business">
    <sequence>
    <element name="id" type="int"/>
    <element name="addresses" type="ns1:list"/>
    </sequence>
    </complextype>
    <complextype name="Address">
    <sequence>
    <element name="id" type="int"/>
    <element name="addresses1" type="string"/>
    <element name="addresses2" type="string"/>
    <element name="addresses3" type="string"/>
    </sequence>
    </complextype>
    ns1:list is included as a separate schema as a complex extension of the base "collection"
    So, even though the Address type is there it is not referenced from Business.
    So, when I'm calling the Web Service from BPEL or ESB, I have not got the ability to map adequately back from the response.
    I have tried a whole bunch of ways of getting this to work, but so far to no avail...
    Has anyone seen this before, or can I somehow override the mapping from the Entity to the WSDL?
    Any help would be most appreciated.
    Thanks
    Chris

    Thanks. We are using a Java Proxy to consume the web service as we need to use JAX-WS handlers. We created data control from the service stub that was created by the proxy. Our issue is with the response XML which comes as a complex type. Also, the data control is understanding the complex type and is creating the structure right. The problem is when we drag that control on a JSF page. No data is displayed. We think that we are not traversing the complex object properly which is creating the issue.
    I understand that you answer related to the input is applicable to output as well. We can change the structure by flattening it but we thought that in 11G there is some new features where we can use the complex types out of the box without any change. Is that true? Also, any luck in finding the documents (broken links) on your blog page?

  • Web service with complex java type

    Hi,
    I create a web service method with String o with Array of Strings without problem. Now I nedd to create a ws that return a table, so I create a class like this:
    public class User {
         private String Name;
         private String.Surname;
         public void setName(String setName){
              Name= setName;
         public void setSurname(String setSurname){
              Surname=setSurname;
    In my ws class I use this object:
    public User[] getUser(String a){
              User[] user = new User[10];
              for (int i=0;i<10;i++){
                   User<i>.setName("aaa");
                   User<i>.setSurname("bbb");
              return user;
    When in WebService Perspective I try to create my ws in wizard mode I see method getUser but I can't check it
    Where is error?
    Thanks
    Andrea

    HI Andrea,
        I think with present netweaver developer studio , we can create Web services with end points as simple data types in java and the array of that simple data types.
        not sure whether it support our own custom developed classes as end points.
         just go through these links.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/f7/af60f2e04d0848888675a800623a81/frameset.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/f7/af60f2e04d0848888675a800623a81/frameset.htm
    from this we will get Restrictions for WS Endpoints.
                             Regards
                              Kishor Gopinathan

  • Web Services with Complex Data Types in ADF 11g

    Shay Shmeltzer's following blogpost can answer my questions but all the links there
    http://blogs.oracle.com/shay/2009/09/web_services_with_complex_data.html
    Can you please point us to the correct links for the following documents?
    http://www.oracle.com/technology/tech/fmw4apps/agile/pdf/adf11g-agile.pdf
    http://www.oracle.com/technology/products/jdev/tips/fnimphius/wsdccomplexinputtype/index.html

    Thanks. We are using a Java Proxy to consume the web service as we need to use JAX-WS handlers. We created data control from the service stub that was created by the proxy. Our issue is with the response XML which comes as a complex type. Also, the data control is understanding the complex type and is creating the structure right. The problem is when we drag that control on a JSF page. No data is displayed. We think that we are not traversing the complex object properly which is creating the issue.
    I understand that you answer related to the input is applicable to output as well. We can change the structure by flattening it but we thought that in 11G there is some new features where we can use the complex types out of the box without any change. Is that true? Also, any luck in finding the documents (broken links) on your blog page?

  • Apex, Web Services, and complex data types?

    Hi all,
    I was wondering if somebody could explain to me what sort of support apex has for using web services with complex data types, and how data returned like this could be interpreted and stored in the database.
    Any help would be aprreciated.
    Thankyou in advance

    Hi can anyone help me with this?

  • Web Service with Complex Results and Flex

    I have created a Enterprise Java Bean that has one "test" method that returns a String[]. I have compiled, deployed and registered this bean in Sun's Application Server 8.1. I am using NetBeans 5.0 to develop this project.
    I try to load this web service into Flex and I get a fault thrown: TypeError: Error #1034: Type Coercion failed: cannot convert []@29e5d06 to XMLList. I have set the returnType in Flex as "e4X.". Do I need to do this in my webservice.
    Any help would be appreciated.

    HI Andrea,
        I think with present netweaver developer studio , we can create Web services with end points as simple data types in java and the array of that simple data types.
        not sure whether it support our own custom developed classes as end points.
         just go through these links.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/f7/af60f2e04d0848888675a800623a81/frameset.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/f7/af60f2e04d0848888675a800623a81/frameset.htm
    from this we will get Restrictions for WS Endpoints.
                             Regards
                              Kishor Gopinathan

  • Report published as web service with parameters

    Post Author: kevinzebeste
    CA Forum: Publishing
    hi,I have a problem in a report published as web service.indeed, the report has a parameter, a date.Client side I do this://I create the parameter             ParameterFields paramFields = new ParameterFields();            ParameterField paramField = new ParameterField();            ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();            paramField.Name = "date";            paramDiscreteValue.Value = "10/10/2006";            paramField.CurrentValues.Add(paramDiscreteValue);            paramFields.Add(paramField);//I add the parameter into the crVievwer            crystalReportViewer.ParameterFieldInfo = paramFields;//I call the web service to get data            crystalReportViewer.ReportSource = "http://localhost/WebService/Rapport1Service.asmx"; Server Side :Now, I want to get back the parameter in the web service (in Rapport1Service.asmx, so server-side) to be able to call my storedprocedure with the good parameter, this one which was put on the client side (10/10/2006).I tried to do crystalReportViewer.ReportSource = "http://localhost/WebService/Rapport1Service.asmx?date=22/10/2006" on the client side but no way. i don't find a solution, is there any way to make this possible ?Moreover, i have one database for each user, so i need to pass the user name, password and account too..

    Post Author: kevinzebeste
    CA Forum: Publishing
    I have found a solution.
    I  create a web service in which i return a dataset, filled with the data wanted.the web service take as parameter: the report name we want, the parameter(s), and the username and password (to check if the user has right to access to data.)After that, I fill the report, client side, with the datasen given. i don't know if it's the best solution but it works !

  • How to create web services with complex objects as parameters

    Hi,
    Not sure if this is the right place, but...
    I'm using Netbeans 5.5 and trying to learn web services.
    Creating a simple web service with simple parameters like strings and integers is nice and easy. I'm now trying to take the next step, and create a web service with a more complex schema as a parameter.
    I've tried two approaches, and hit dead ends on both:
    (1) Define my complex schema as an xsd file, and then create a WSDL file. Creating the schema and saving it in my EFB project works fine; when I try to create a new WSDL file, the IDE gives me a button to import external schemas - which is where the problem is: the Browse simply won't find my newly created schema file.
    (2) Define a Java class (in this case, it's a fairly simple example containing a single ArrayList), and then use the IDE to generate a web service from Java. The IDE does this fine, but I now have no idea how to consume or test the web service - I don't know where to look for the WSDL that has presumably been generated, and I'm also a bit iffy over what answers to give the WSDL creator about port names etc.
    Ideally, I'd prefer to get approach 1 to work - can someone point me in the direction of a sensible tutorial for these things?
    (Happy to carry on using Netbeans 5.5 or to revert to Sun Studio Enterprise, which I was playing with before.)
    All help appreciated, Thanks

    - For NetBeans related questions, nbusers mailing list is more suited. It is often visited by NetBeans experts.
    http://www.netbeans.org/community/lists/top.html
    ...[email protected]
    The NetBeans users mailing list. General discussion of NetBeans use, this is the place to ask for help and to help others.... (There is a 'Subscribe' button next to the above that you can use to subscribe to the list).
    Can you try posting this question on nbusers list?
    - SJSE 8.1 is based on an older version of NB (NB5.0).
    You should definitely continue with NetBeans, since all development is now being done in NetBeans; all the major JSE modules have been moved to opensource at netbeans.org and are all being developed there. There are as yet no future plans to work on further releases for JSE.
    Please check out http://www.netbeans.org for more details.

  • Pl Help......Web services with complex types

    Hi,
    I have deployed a web service on OC4J (9.02) having a complex type input and a complex type return. The web service is implemented as a stateless session bean and
    the relevant web.xml for the deployment is:
    <servlet>
    <servlet-name>ZipLookupManager</servlet-name>
    <servlet-class>oracle.j2ee.ws.SessionBeanWebService</servlet-class>
    <init-param>
    <param-name>jndi-name</param-name>
    <param-value>ZipLookupManagerBean</param-value>
    </init-param>
    <init-param>
    <param-name>class-name</param-name>
    <param-value>com.indus.banner.components.cdyne.ZipLookupManagerBean</param-va
    lue>
    </init-param>
    <init-param>
    <param-name>interface-name</param-name>
    <param-value>com.indus.banner.components.cdyne.IZipLookupManager</param-value
    >
    </init-param>
    <init-param>
    <param-name>custom-bean-qname</param-name>
    <param-value>
    com.indus.banner.components.cdyne.LatLongReturn,
    http://cdyne.components.banner.indus.com,
    LatLongReturn,
    org.apache.soap.encoding.soapenc.BeanSerializer,
    org.apache.soap.encoding.soapenc.BeanSerializer
    </param-value>
    </init-param>
    <init-param>
    <param-name>custom-bean-qname</param-name>
    <param-value>
    com.indus.banner.components.cdyne.ZipState,
    http://cdyne.components.banner.indus.com,
    ZipState,
    org.apache.soap.encoding.soapenc.BeanSerializer,
    org.apache.soap.encoding.soapenc.BeanSerializer
    </param-value>
    </init-param>
    </servlet>
    The web service deploys correct. I have all the relevant jars in the %J2EE_HOME%\lib folder. However, when I call the web service from a standalone client I get the following error:
    java.lang.ClassNotFoundException:
    org.apache.soap.encoding.soapenc.BeanSerializer
    at
    oracle.j2ee.ws.GeneratedClassLoader.findClass(GeneratedClassLoader.ja
    va:48)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:262)
    at oracle.j2ee.ws.BaseWebService.initQnameMap(BaseWebService.java:602)
    at oracle.j2ee.ws.RpcWebService.init(RpcWebService.java:453)
    at
    oracle.j2ee.ws.SessionBeanRpcWebService.init(SessionBeanRpcWebService
    .java:54)
    at javax.servlet.GenericServlet.init(GenericServlet.java:258)
    at
    com.evermind.server.http.HttpApplication.loadServlet(HttpApplication.
    java:1956)
    at
    com.evermind.server.http.HttpApplication.findServlet(HttpApplication.
    java:4355)
    at
    com.evermind.server.http.HttpApplication.getRequestDispatcher(HttpApp
    lication.java:2484)
    Please advise!
    Rizwan

    Hi all,
    I haven't heard back from anyone. Is this forum alive still? I have entered a TAR on metalink on this issue but they say that apparently this was a defect under 9.02 and has been fixed under 9.04.
    Please help.
    Many thanks in advance.
    Rizwan

  • Accessing a web service with complex types

    Hi I have been struggling with this web service for a while
    now....
    I am trying to send input parameters that are composed by :
    applicant name( name, surname, .....) and applicant input address(
    hse no, street, postcode...) Applicant dob(dob)....I am using
    <cfscript> tag to pass these parameters...Now my problem is
    do i need to put each complex type inside its own <cfscript>
    tag???
    ie:
    stName = structNew();
    stName.Title = "#Mr#";
    stName.forename = "Man";
    stName.othernames = " NA";
    stName.Applicant = "Yellow";
    stName.suffix="";
    stName.dob = createDate(1972,06,05);
    and do this for applicant address? or could i enclose this in
    under the same cfscript tag??
    Any help would be appreciated...thanks
    critical

    Check out
    http://hcc.musc.edu/research/shared_resources/xml_complex_types_to_cf_structure_notes.cfm
    The last part of that link is .cfm - not sure why its getting
    cut off.

  • Flex services with multiple return types

    Hello,
    We are creating a webapplication with flex and php.
    Everything is working very good, until we got to the library part of the application.
    Every service so far had only 1 return type (eg: User, Group, ...)
    Now for the library we want to return a ArrayCollection of different types of objects. To be more specific the LibraryService should return a ArrayCollection containing Folder and File objects.
    But how to configure this in Flex (Flash Builder 4 (standard))?
    So far it converts every object to the type Object, i would really like it to be Folder or File
    The only solution we can think of right now is to create a new object Library that will contain 2 ArrayCollections, one of type Folder and one of type File. This could work ofcourse, but I wonder if there is a better solution for this OR that i can configure multiple return types for a service.
    Any ideas/advice is greatly appreciated.

    Normally if you are using Blazeds(Java stuff, i'm sure there should be something similar for php), you can map java objects to that of the AS objects, when you get the data back you are actually seeing the object which is a Folder or a File object rather than just a Object.

  • Invoking a bpm process with web services with a return value

    Hello,
    Im invoking a bpm process in my application using web services. The problem is that I want to get a responde with the process id of the created process, but not wait for the finishing of the process. Is this possible?
    thank you

    Assuming this is for Oracle BPM 11g.
    I'm a novice at this and sure others will have infinitely better ideas (have I lowered your expectations enough?), but here are two thoughts. Both of these ideas assume that your child process was invoked by an Oracle BPM parent process.
    When you expose a process as a web service and invoke it asynchronously from a parent process, there is a call back service available. I've yet to figure out exactly how to get it to work, but if you look at the "Start" event's property in the composite (it's the service) you will see the callback information in the bottom dropdown. I believe what this means is that from your child process, you can use a Service activity to invoke a service that invokes the callback service back to the parent process's Service activity.
    My other idea (you're not going to like this one) would be to to invoke the subprocess using a Message Start Event activity instead of the Service activity you're currently using. If you go this route, then you could have your parent process kick off the child subprocess using a Message Start Event activity and then immediately after this have a Message Catch Event activity. The child process could have a Message Throw Event activity immediately after its Start Message Event activity that sends a notification to the parent process. The good part about this is that I've actually gotten this to work.
    You can send argument information back to the parent process, but (sorry) I don't yet know how to capture the process id.
    Wish I could be of more help and hope this helps a little.

  • Web Services with Complex Objects (Urgent !!)

    Hi,
    My last post was on a problem using IBM-RAD (Service) and AXIS2 (Client) in "New to Java" Forum. That is one of the trial scenarios I'm working on nowadays. Hope, I'll get some useful reply soon.
    Now, I need a suggestion about the application I'm working upon. It is as follows:
    (i) The application (i.e. Service Class) takes some primitive,String and/or some bean object as input
    (ii) It returns a bean object [or an array (can use collection class also if possible) of bean objects].
    (iii) The bean properties are primitive,String , other bean objects, and/or some collection object(Vector / ArrayList etc.) i.e. it should handle complex objects.
    (iv) The Service should run on Websphere and Client on Tomcat.
    A pictorial representation is given below:
    [primitive/String/bean object (Input arg)]
    [(Contains  primitive/String/other bean objects/collection class)] Bean <---------> Service <----------------------- Client
    [Calls bean] |===============> Client
    [Returns bean (or array of beans / collection object)]
    I'm now trying (by building test applications) a combination of IBM-RAD (Service) and AXIS2 (Client), but facing problems in handling array of beans and/or collection classes either on Service or on the Client side.
    So, I need some suggestions on whether I'm going the right way, or need to change my approach (or technology). Any suggestion would be appreciated.
    Please reply ASAP, it is urgent.
    Thanks in advance,
    Suman

    no problem for me, so it's not urgent.
    Request for help denied.

  • XDB Native Web Services - Collection of object types

    Hello,
    my DB 11g (11.1.0.6.0) is enabled to use XDB Native Web Services, everything works as it should. I already use it successfully to publish a web service with object types as OUT parameter. They are created as complex types in the XML response as described here: [http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28369/xdb_web_services.htm#CHDGBFID]
    But what I need is a collection of these object types, e.g.
    I have a type FLIGHT with some information elements (departure, arrival, date, time, price) and I have a web service function GET_AVAILABILITY with parameters departure, arrival and date. What I want is to return a collection of FLIGHT objects, it could be none, one or many flights for a request.
    For the moment I create another object type which contains a fix number of FLIGHT objects to work around the collection issue:
    create flight_tab_typ as object (
    fl1 flight_typ
    ,fl2 flight_typ
    ,fl3 flight_typ
    I tried to build a PL/SQL table of object type and also a VARRAY of object type but for both the WSDL of the web service cannot be build up correctly in the web browser. For me it seems that this is not supported by the Native Web Services.
    I know I can build up my own XMLTYPE with XML structure as OUT parameter but to use object types is much easier and it builds up the XML structure automatically.
    Does anybody know how to use collections (VARRAY or PL/SQL Tables) with the Native XML DB Web Services?
    Thanks,
    Andreas

    Hi flea,
    I use complex types with XDB native webservices. Here is an example. Using people/groups objects. I haven't compiled this so there may be some typos etc, but it should give you the idea.
    Beware!I have had problems with the created WSDL file in that it doesn't always include the namespace from all types. In many client packages ( JDevloper , SOAPUI etc) this causes a wsdl import failure.
    You can add the missing namespace by hand a load the WSDL file locally and then it should work. I haven't raised an SR with Oracle about this yet.
    Assume you create the following under SCoTT schema on machine host.com on port 8080.
    The webservice[WSDL] will be available from
    http://host.com:8080/orawsv/SCOTT/WEBSERVCIES/GET_GROUP[?wsdl]
    For other peoples sanity it took me a little while to realise the WSDL url is case specific. E.g. the schema, package and functions have to be UPPER case.
    create table people_groups_tab (group_name varchar2(40 char),first_name varchar2(40 char),last_name varchar2(40 char))
    insert into people_groups_tab values ('FINANCE','Joe','Bloggs')
    insert into people_groups_tab values ('FINANCE','Bob','Jones')
    insert into people_groups_tab values ('IT','Alan','Andrews')
    create or replace type person_obj
    as object
         first_name people_groups_tab.first_name%type
         ,last_name people_groups_tab.last_name%type
    create or replace type people_obj
    as table of person_obj
    create or replace type people_groups_obj
    as object
    group_name varchar2(40 char)
    people people_obj
    create or replace package webservices
    as
              function get_group
         p_group_name varchar2
              ) return people_groups_obj;
    end;
    create or replace package body webservices
    as
              function get_group
         p_group_name varchar2
              ) return people_groups_obj
    as
    l_group people_groups_obj;
              l_people people_obj;
    begin
              select person_obj
                        first_name
                        ,last_name
              bulk collect into l_people
              from people_groups_tab
              where group_name p_group_name;
              l_group := people_groups_obj(p_group_name,l_people);
              return l_group;
    end;
    end;
    /

Maybe you are looking for

  • CS5 SDK Error compiling Adobe examples.

    Hi, I downloaded the trial version of Illustrator CS5 and the CS5 SDK to be able to adapt my plugins. These plugins are for CS4. Each time I try to compile one of the samples provided in the CS5 SDK, I have the same error error: extra qualification '

  • Some help please? Let's get Solaris 10 out there!

    I'm on eBay, I'm always on eBay, and the sheer amount of JAVA they spit out is amazing. Chokes the heck out of this Win2K OS. Anyone out there have better results with Solaris 10? I'm seriously considering putting a separate desktop together with Sol

  • ALSA : LADSA plugin syntax help

    Hey all, I just set-up my .asoundrc file on a new build.  Using the declip plugin, in my alsa config, is producing some sound in the left channel, and only silence, interrupted by repetitious clicks, in the right channel.  Using Audacious, which ship

  • Update issues

    my spreadsheet i made on my ipad wont open on my mac as it says i need the new version of the software. when i go to the store it says no updates available.

  • Copy existing PR00 condition record

    Hi experts, I want to copy existing PR00 condition record. Can someone explain the steps? I searched this forum but could not get any results for this question. Thanks