How do I send XML to a web service?

I am brand new to Flex. I am trying to write a program that
uses web services to send and receive data. I have gotten it so
that it can receive XML from the web service. However, I also need
to send it, and I am stuck.
I have tried the following code:
<mx:WebService id="MyService"
wsdl="
http://localhost/FlexTest/service1.asmx?WSDL"
useProxy="false"
result="resultHandler(event)">
<!-- Input: XML Document...Output: String -->
<mx:operation
name="HelloPersonAcceptsXmlDocumentReturnsString">
<mx:request>
<personXmlDoc>xmlPerson</personXmlDoc>
</mx:request>
</mx:operation>
<!-- Input: XML Node...Output: String -->
<mx:operation
name="HelloPersonAcceptsXmlNodeReturnsString">
<mx:request>
<personXmlNode>
xmlPerson.Person
</personXmlNode>
</mx:request>
</mx:operation>
<!-- Input: String (XML Format)...Output: String -->
<mx:operation
name="HelloPersonAcceptsXmlStringReturnsString">
<mx:request format="xml">
<personXmlString><p1:Person xmlns:p1="
http://impact-tech.com/schemas/FlexTest"><p1:ID>f1bd45fc-544b-489d-83cf-349d1f9740ec</p1:I D><p1:FirstName>Joe</p1:FirstName><p1:MiddleName>C.</p1:MiddleName><p1:LastName>Blow</p1:L astName><p1:BirthDate>2006-09-11T14:03:04.4755443-04:00</p1:BirthDate><p1:IsMarried>false< /p1:IsMarried><p1:NumChildren>0</p1:NumChildren><p1:NetWorth>100000</p1:NetWorth></p1:Pers on></personXmlString>
<!--<personXmlString>{xmlPerson.toXmlString()}</personXmlString>-->
<!--<personXmlString>{txInput.text}</personXmlString>-->
</mx:request>
</mx:operation>
</mx:WebService>
In the first operation,
"HelloPersonAcceptsXmlDocumentReturnsString", I try to send an XML
object. In the second operation,
"HelloPersonAcceptsXmlNodeReturnsString", I try to send the root
node, xmlPerson.Person. In both cases, what actually gets sent is
literally the text that I put in the <request>node, not the
object that text is referencing. So for the first, "xmlPerson" gets
sent to the target, not the XML doc that it refers to.
In the third operation, I tried three different things, and
two are commented out. I tried to reference the XML object using
the toXmlString() method, but again, it literally sent the text
"xmlPerson.toXmlString()". I tried the curly-brace binding, but
then nothing gets sent to the web service. I also tried building
the actual XML document node by node, with values, but I get an
error from the web service saying it can't be parsed because there
is an illegal character at Line 1, Position1. The only thing which
has worked has been to add an Input Text box, copy-and-paste the
exact same XML structure as I tried to manually build, and then use
binding to the text property of the InputText control. Then it
works fine. But I can't actually do that, it's just for testing.
So my question is how to make a <request> node that is
part of the web service operation that references an object and
sends the value of that object to the web service, not literally
whatever text is typed in that node. I looked at the Web Services
and Data Binding sections of the help, and didn't see any examples
covering this. Everything was far more simplistic with binding to
controls. Can anyone help a newbie, please?

I don't understand how this isn't a Flex Builder question,
since it has to do with how Flex Builder interacts with web
services and how objects are used in binding in MXML.
But at any rate, I got this code to work, for future
reference of anyone else looking in this forum:
Declaring a custom class in MXML was key to allow proper
binding:
<CustomClasses:Person id="testPerson" xmlns:local="*"/>
<mx:WebService id="MyService"
wsdl="
http://66.129.123.211/FlexTest/service1.asmx?WSDL"
useProxy="false"
result="resultHandler(event)">
<!-- Input: XML Document...Output: String -->
<mx:operation
name="HelloPersonAcceptsXmlDocumentReturnsString">
<mx:request>
<personXmlDoc>{testPerson.GetXmlDoc()}</personXmlDoc>
</mx:request>
</mx:operation>
</mx:WebService>

Similar Messages

  • Send Multipart message in web service

    Hi All,
    I have configured IDoc-SOAP-File scenario successfully.
    Now My sender and receiver structure is changed.
    I mean in my Idoc i cn have node repeated number of times and so i have changed my occurace at wsdl file also, so tht for all web service will be call only once and response will also have 1-unbound occurance.
    When i run sceanrio...i m able to send Idoc with multiple node in it and request is futher sent to web service.
    But in response i m gettin response only for first one as web service is just sending/accepting (?) data for 1st occurance of node.
    Please guide me for same tht how i can send multiline data to web service and accept multiline responce.
    Regards,
    Manisha

    Check this note: https://service.sap.com/sap/support/notes/856597
    Q: My web service expects a SOAP with multiple elements in the SOAP body. How can I create such SOAP message?
    Check if you have done the setting as mentioned in the answer.
    Regards,
    Abhishek.

  • How to create a proxy to retrieve the xml file from web services

    Hi Every one,
    We have a requirment where we receive a xml file from Kenexa, a third party HR tool using a middleware tool. from SAP side We have to create a proxy to retrieve the xml  file from web services by initiating call through middleware tool i used earlier.
    these are the steps i intend to follow to accomlish the requirement.  
    1) middleware tool has to initiate the call to kenexa web services to  receive the xml file when it is available.
    2) On SAP we need to create a ABAP Proxy service provider to middleware where this file can be received.
    Can any one guide me how i can create a proxy to retrieve the xml  file from web services by initiating call through other middlewre (its not PI). 
    Any help would be really great, i am not a ABAP developer, so please help me with this. Thanks.

    Thank for reply.
    The computers are in different locations, but yes it's possible, the users in this enviroment are all local administrator of the machines, and we can distribute the script centrally from the DC automatically
    Acrobat use Java, right? I'm not so expert in java, but something about it could not be so difficult to manage.
    Do you know some place where i can get some info about JS and acrobat?

  • Download a XML file from Web Services Using Flex

    Hi All...
    I am new for flex, im developing a windows application using Flex/Air, i have connected the web services with user authentication, now I want to download a xml file using web services in flex,
    how can i do this?? please reply...
    Thanks in advance
    Vasanth

    Hi All....
    I have done this myself using sample tutorials...
    here is the code for your reference guys
              plyLoginName = txtEmailIdDownload.text;                
                     var urlpath:String = new String("your url p?LoginName=");
                    urlpath = new String(urlpath.concat(plyLoginName));
                    urlpath = new String(urlpath.concat("&PlayerType="));
                    urlpath = new String(urlpath.concat(chkseasonvalue));
                    Alert.show(urlpath);
                var request:URLRequest = new URLRequest(urlpath)
                var fileRef:FileReference = new FileReference();           
                fileRef.download(request,"yourfilename.xml");
                Alert.show('File downloaded Successfully');   
                 txtEmailIdDownload.text = "";
                txtPWDownload.text = "";
    thanks
    Vasanth

  • Returning xml string in web service call

    hi all
    i'm writing a server-side web service
    one method i am writing returns a recordset from a db query. i then use jdom to trasnform the recorset to xml and i retrun the xml as a string
    however, my client who is using this web service is having difficulty with the xml string i return - instead of angle brackets it is retruned as &alt &agt
    the client is now able to get rid of the &alt signs but now he cannot traverse through the xml to get the elemnts
    i'm using this code to retrun the xml
    how do others retrun xml within their web sevices?
    try
    RecordsetToXML rsXML = new RecordsetToXML(rs, "ROOT", "UCWSTATS");
    Document jDOMDoc = rsXML.build();
    rs = null;
    XMLOutputter outputter = new XMLOutputter();
    outputter.output(jDOMDoc, writer);
    result = writer.toString();
    writer.close();
    return result;

    Does result end up with a String containing the offending encoded characters, or does it occur when you transfer the xml over the pipe?

  • How can I authenticate and authorize with Web Service on ESB ?

    Hello,
    I want to authenticate and authorize client with Web Service published
    by HTTP/SOAP BC.
    Simply if it is an Web Service as J2EE application, I will use
    Basic Authentication with JAX-RPC and Realm.
    But I think that Web Service published by HTTP/SOAP BC is not belong
    to J2EE Application. Threre is no place to describe security role mapping
    (like web.xml).
    JBI 1.0 the section "5.5.1.1.3 Normalized Message Properties" comments
    JAAS Subject is given in the NM Properties. Really in this package
    com.sun.jbi.internal.security.*
    implements JAAS autentication and authorization (at JaasAuthenticator).
    But I can't see how to configure my Service to use this.
    How can I authenticate and authorize with Web Service on ESB ?
    I referred to the resources.
    Mutual Authentication for Web Services: A Live Example
    http://developers.sun.com/prodtech/appserver/reference/techart/mutual_auth.html
    XML and Web Services Security
    http://java.sun.com/j2ee/1.4/docs/tutorial/doc/Security7.html
    JAAS Authentication Tutorial
    http://java.sun.com/j2se/1.4.2/docs/guide/security/jaas/tutorials/GeneralAcnOnly.html
    Thanks,
    Takurou
    - environment ---------------------------------------------
    OpenESB : Project Open ESB Starter Kit
    AppServer : Sun Java Systems Application Server 9.0 PE
    OS : Windows XP
    I don't assume to use SSL (if It's necessary I will try).
    User information is stored in a LDAP Server.
    -----------------------------------------------------------

    Hello,
    I read this resource.
    SecurityDesign
    http://www.glassfishwiki.org/jbiwiki/Wiki.jsp?page=SecurityDesign
    Then I think [non-ssl and ssl/tls and so on] securing by basic authentication is ongoing feature at this time.
    But I can't see well why this page comments 'HTTP over SSL, TLS'.
    HTTP/SOAP Binding Component Overview
    http://download.java.net/general/open-esb/docs/jbi-components/httpsoap-bc.html
    Does BC support only "SSL server authentication" ?
    Doesn't BC support "SSL client authentication" by username/password ?
    Thanks,
    Takurou

  • How to get up and run a Web Services/RESTful functionality?

    Hello there,
    The DBAs just completed the upgrade for the APEX 4.2 in our organization. I was asked to work with APEX and build some application. This morning I was asked by my boss to take a look at getting the Web Services/RESTful API Functionality up and running. I am new to this environment. When I check the RESTful Services I found out the are no RESTful Services. What do I do to get this running? as a Developer, I do not have access to any schema or web services. How do I go about making this work? can any one point me to some blog or site that will help me make this work?

    Hello,
    You can consume Web-Services from APEX, but you can't produce. So first ask your boss which web-service you want to implement.
    There are 2 types of web services in general, SOAP based and RESTful. APEX provides simplified API's to invoke both types web-service.
    Identify web-service you want to TEST
    Create ACL for APEX_XXXX schema to access web-service
    Create ACL for Proxy Server as-well, if required
    If web-service is SSL-enabled then configure wallet. See 17.7 Implementing Web Services
    Use APEX API's to invoke Web-Services. See APEX_WEB_SERVICE
    You can process XML response from Web-Service using Using XQuery with Oracle XML&amp;nbsp;DB
    If Web-Service returns JSON data either you can use PL/JSON | Free software downloads at SourceForge.net to process response, or you can process response at client side using jQuery
    Regards,
    Hari

  • Return XML document through Web Service?

    Hello,
    Is it possible to return a XML document from a web service?
    For example, I have a Oracle Report that outputs in XML format, is it possible to return that through a web service?
    Any suggestions or pointers will be most appreciated.
    Nilan

    Hi Nilan,
    You can see a simple example here.,on how to pass and receive XML elements as web service params.
    http://otn.oracle.com/sample_code/tech/java/codesnippet/webservices/docservice/content.html
    A tutorial on Using Web Services with Oracle9i Reports
    http://otn.oracle.com/tech/webservices/htdocs/series/reports/content.html
    Regards
    Elango.

  • XML Beans in Web Services / .xsd compilation

    Hello friends -
    I've been told of many wonderful things that can be accomplished by using XML
    beans in web service style integrations. However, I'm running into trouble actually
    getting anything done and was hoping someone could give me a few pointers. I'm
    trying to work inside Workshop 8.1 with the BEA server (i.e., not platform)
    - Documentation seems to reference the ability to compile an .xsd in order to
    get an XML Bean class representing your XML. However, I cannot find anything
    telling me how to do this. Is this supported in Workshop?
    - I'm only showing some classes referenced in the XML Beans Javadoc area as available
    inside my workshop IDE. For example, com.bea.xml.XmlBeans is not available.
    Is this a result of me using Server as opposed to the more complete Platform
    product?
    - Does anyone have a simple example .jws that utilizes a XML bean as an input
    or output? If so, I'd love to see it.
    Thanks so much.
    CM

    Hi,
    I thought passing XMLs was supported using SOAP. In this case, the XML data in the SOAP body is type "string" and the namespace of the XML inside separates it from the rest of the SOAP package. Can I do the same with...say... Web Dynpro where the WSDL is used to generate proxy classes. How do I add a namespace in the SOAP header so that I can add the XML in the body?
    I propose that life would be much easier if a datatype called XML, or some option before the WSDL is imported to create proxy classes is available which creates a wrapper for adding XML data. Far fetched...but can be done. Whats you opinion?
    Regards,
    Nirav Mehta

  • How to integrate Microsoft and SAP using Web Services?

    Hi All
    How to integrate Microsoft and SAP using Web Services? If any one has document please send it to me. My id is [email protected]... Please
    Help me
    Best Regards
    Ravi Shankar

    Hi Ravi,
    This is for Customizing Email and Other Web Services.
    Create addresses
    The address maintenance of R/3 users is carried out either via the R/3 User Maintenance (Transaction SU01) or the Private office settings (Transaction SO12):
    Address --> Other communication...
    Selection of the required communication service.
    Enter address.
    Copy or save.
    b) Configuration of SAPconnect (Transaction SCOT)
    Set communication method
    4.0 + 4.5: Goto --> Customizing --> Communication methods
    as of 4.6: Settings --> Communication methods
    Set the method of the required communication service to the value 'SAPCONNECT' and save the setting.
    Customized the same for Internet mailing.
    C) If you want to Transfer Table Structure Values from SAP R/3 to Web Services then
           1. Create BAPI and Transfer whichever things you want.(Note: The Structure
               of BAPI should be similar to Web Structure (Datatypes).
           2. Create a BDC and Schedule it in the Background.
    Hope it helps you, Awaiting for the Reward Points.
    Thanks
    Subrato Chowdhury

  • How can I create a query with web service data control?

    I need to create a query with web service data control, in WSDL, it's query operation, there is a parameter message with the possible query criteria and a return message contains the results. I googled, but cannot find anything on the query with web service. I cannot find a "Named Criteria" in web service data control like normal data control. In Shay's blog, I saw the topics on update with web service data control. How can I create a query with web service data control? Thanks.

    Hi,
    This might help
    *054.     Search form using ADF WS Data Control and Complex input types*
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/index-101235.html

  • Sending plain request to web service using receiver sender adapter and PI and expecting as attachment as response

    Hi
    In my scenario,we are sending plain request to web service using receiver sender adapter and PI will receive response as excel attachment. What are standard module required to achieve this and sequence? or checking Keep attachment box will help us to achieve this? 
    is it possible to receive excel sheet as attachment from receiver soap adapter ?
    Thanks in Advance

    Hi,
    This issue might be due to the invalid .pem certificate file.
    Make sure to include the beginning and end tags on each certificate.                   
    The result should look like this:                
    -----BEGIN CERTIFICATE-----
    (Your Primary SSL certificate: your_domain_name.crt)
    -----END CERTIFICATE-----
    -----BEGIN CERTIFICATE-----
    (Your Intermediate certificate: DigiCertCA.crt)
    -----END CERTIFICATE-----
    For more detailed information, you could refer to:
    https://www.digicert.com/ssl-support/pem-ssl-creation.htm
    Regards

  • How to expose ODI scenario as a web service

    How to expose ODI scenario as a web service?
    Can we generate wsdl of ODI scenario if yes then how?

    SSZ wrote:
    Yes.But couldn't understand where to start.In that case use the magic wand.
    Ask specific questions, Many of your posts have an underlying tone , that of you not having read any documentation of bothered to research anything yourself I havent got the time to tell you how if you havent got the time to tell me what you have read , what you grasp and what you do not grasp.

  • How to access HTTP Header from within Web service?

    Hello,
    Is there a way to access HTTP header variables like CONTENT_TYPE, CONTENT_LENGTH from within Web Logic web service.
    I was able to get the HTTP header variable from within Apache AXIS services by calling context.getProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST
    How can i do this from weblogic web service.
    I need this to verify the client SSL_CLIENT_DN
    In access I can get the header as follows.
    HttpServletRequest req = (HttpServletRequest) context
              .getProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST);
    clientID = req.getHeader("SSL_CLIENT_S_DN_Email");
    Thanks
    --Arun                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    hi
    the following link may helpful to you
    http://e-docs.bea.com/wls/docs81/webserv/anttasks.html#1111537
    Regards
    Prasanna Yalam

  • How to retrieve the HttpSession from Axis Web Service

    hello,
    How can I get the HttpSession in Web Service ???
    Eric

    Hi,
    I have generated the java classes from a WSDL using WSDL2Java using the following command line options.
    java -classpath .;%AXISCLASSPATH%;%CLASSPATH% org.apache.axis.wsdl.WSDL2Java -s -S true -d Session -Nhttp://localhost:
    7001/axis=samples.grapha -a samples\grapha\grapha.wsdl
    I need to retrieve HTTPSession in the generated GraphASOAPBindingImpl class. Can you help me?
    Thanks,
    vc

Maybe you are looking for

  • How to get safari to open to the last page I was on and screens to enlarge automatically?

    Hello, I just upgraded to the latest iMac version from my 2010 model, and whenever I close and open up safari it opens to top siotes instead of the last page I was on, and every time I open it I have to enlarge it myself by clicking the arrows in the

  • How to set billing doc parameter for multiple selection ?????

    Hi all, Output for Billing VF31, SD70AV3A i would like to add ‘Multiple selection’ to the Billing Document parameter.  multiple Currently, it would only give data for one of the documents in the selection. According to me the billing parameter can be

  • My purchased songs no longer available to download

    Recently I had to wipe my laptop of a bunch of files, including my music. When I went to re-download all of my purchased music, it wasn't there. I checked the albums to make sure that they were still being sold (they were), and then I downloaded the

  • Book files stored in Creative Cloud not syncing

    Hi everyone! We are working on a project that is stored in Creative Cloud to take advantage of collaborative workflow. Everything is working fine so far. I've just created a book and added a few files so that I can sync styles, master pages, etc. Thi

  • Why does iCal work only some times? how can I fix it?

    I think iCal is great. But sometimes it only shows the month but not the heading so I can move to another month. Other times when I go into the menu I can not add new events as this item is grayed out? Also if I try to go to a different day it doesn'