axis and soap from javascript ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Eric Osman

    #1

    axis and soap from javascript ?


    If my question sounds ill-formed, please cut me some slack as I'm just
    getting started with this part of the code.

    We're trying to do an axis soap interface, that is, talk to a site that
    already has a defined "dtd" .

    I've already seen some java examples that use SOAP and AXIS to do the
    communication.

    However, we'd like to communicate from client-side javascript instead of
    apache server java.

    Do any of you know how to do this ? Or have examples ? Or can point me
    to existing packages or examples ?

    NOTE: We're already talking to web sites with GET and POST by using
    XMLHttpRequest in javascript so is there something like that we can use
    to do the SOAP and AXIS kind of communication ?

    Thanks. ericosman@rcn.c om 4/2/2004

  • Abdullah Kauchali

    #2
    Re: axis and soap from javascript ?


    "Eric Osman" <ericosman@rcn. com> wrote in message[color=blue]
    > However, we'd like to communicate from client-side javascript instead of
    > apache server java.[/color]

    Firstly, why? <g>


    Comment

    • Brian Genisio

      #3
      Re: axis and soap from javascript ?

      Eric Osman wrote:[color=blue]
      >
      > If my question sounds ill-formed, please cut me some slack as I'm just
      > getting started with this part of the code.
      >
      > We're trying to do an axis soap interface, that is, talk to a site that
      > already has a defined "dtd" .
      >
      > I've already seen some java examples that use SOAP and AXIS to do the
      > communication.
      >
      > However, we'd like to communicate from client-side javascript instead of
      > apache server java.
      >
      > Do any of you know how to do this ? Or have examples ? Or can point me
      > to existing packages or examples ?
      >
      > NOTE: We're already talking to web sites with GET and POST by using
      > XMLHttpRequest in javascript so is there something like that we can use
      > to do the SOAP and AXIS kind of communication ?
      >
      > Thanks. ericosman@rcn.c om 4/2/2004
      >[/color]

      Do you mean client-side Java, instead of client-side Javascript? I do
      not think you can do SOAP communication with javascript alone. You need
      at least a plugin.

      Brian

      Comment

      • Jim Ley

        #4
        Re: axis and soap from javascript ?

        On Fri, 02 Apr 2004 10:36:24 -0500, Eric Osman <ericosman@rcn. com>
        wrote:
        [color=blue]
        >NOTE: We're already talking to web sites with GET and POST by using
        >XMLHttpReque st in javascript so is there something like that we can use
        >to do the SOAP and AXIS kind of communication ?[/color]

        SOAP is just a pointless XML serialisation of some methods over HTTP,
        you have all you need, I would urge you to reconsider, given the
        restricted nature of JS client-server communication, there is no point
        using a misguided heavyweight system designed for interfacing between
        unknown systems when you control both ends (*) Use simple known
        methods.

        Jim.

        (*) To some degree you control the client, you can at least control
        the things you intend to send.
        --
        comp.lang.javas cript FAQ - http://jibbering.com/faq/

        Comment

        • Eric Osman

          #5
          Re: axis and soap from javascript ?


          [color=blue]
          > SOAP is just a pointless XML serialisation of some methods over HTTP,
          > you have all you need, I would urge you to reconsider, given the
          > restricted nature of JS client-server communication, there is no point
          > using a misguided heavyweight system designed for interfacing between
          > unknown systems when you control both ends (*) Use simple known
          > methods.
          >[/color]


          Gee, now I'm glad I included that part about "ill-formed question".

          I actually don't really want to use SOAP.

          What I do want is the ability to send and receive xml from javascript
          and talk to a web service.

          It's been suggested to me that I look more into the "msxml" package,
          which we have already been using to do XMLHttpRequest, and see what
          functions it includes for sending and receiving and parsing xml.

          Do you believe I'm on the right track ?

          Thanks. /Eric


          Comment

          • news.comcast.giganews.com

            #6
            Re: axis and soap from javascript ?

            >[color=blue]
            > It's been suggested to me that I look more into the "msxml" package,
            > which we have already been using to do XMLHttpRequest, and see what
            > functions it includes for sending and receiving and parsing xml.
            >
            > Do you believe I'm on the right track ?
            >
            > Thanks. /Eric
            >
            >[/color]

            Eric,

            Hi...Here's an example of using Microsoft's implimentation XMLHTTP.
            You'll want to do a lot more reading up about it...consider going down
            to your local full-service bookstore, or looking for a text on line, or
            <gasp/> googling for more info...but this will get you started:

            var XMLHTTP = new ActiveXObject( 'Msxml2.XMLHTTP ' );

            var XMLRequest = new ActiveXObject( 'Msxml2.DOMDocu ment' );
            var XMLResponse;

            var method = 'POST';
            var async = false;

            // TODO: Change the string in the next line to whatever xml you need to
            send...
            var xmlString ='<root><conten t>Here is some text</content></root>';

            // TODO: Change the next line to the web address of the server you are
            // trying to get information from
            var url = 'http://localhost/server.asp';

            var bSuccessfullyLo aded = XMLRequest.load XML( xmlString);

            if( bSuccessfullyLo aded )
            {
            debugger;
            XMLHTTP.Open( method, url, async );
            XMLHTTP.Send( xmlString );
            XMLResponse = XMLHTTP.respons eXML;

            if( 0 == XMLResponse.par seError.errorCo de )
            {
            // TODO: Do something useful here once you
            // successfully get a response...
            window.alert( XMLResponse.xml );
            }
            else
            {
            // TODO: Handle the parsing error here
            window.alert('A Parse Error');
            }
            }


            Good Luck!

            --Geoff McGrath


            Comment

            • Jim Ley

              #7
              Re: axis and soap from javascript ?

              On Fri, 02 Apr 2004 18:05:40 -0500, Eric Osman <ericosman@rcn. com>
              wrote:
              [color=blue]
              >What I do want is the ability to send and receive xml from javascript
              >and talk to a web service.[/color]

              Sending and recieving XML with javascript other than in a reduced
              security environment (so you're generally talking web-services) XML
              parsing and GET/POST HTTP is available on a number of javascript
              capable systems (IE/Mozilla and SVG Clients) it's a lot slower than
              parsing other things - JSON being perhaps the most obvious.

              Because you control both the client and the server, you don't need to
              use the XML benefits.
              [color=blue]
              >It's been suggested to me that I look more into the "msxml" package,
              >which we have already been using to do XMLHttpRequest, and see what
              >functions it includes for sending and receiving and parsing xml.
              >
              >Do you believe I'm on the right track ?[/color]

              you could do it like that, I wouldn't recommend not doing so, it's
              very inflexible. Maybe look at http://json-rpc.org/ or similar, but
              anything that doesn't use XML parsing will open up the possibilities
              considerably, that's the hardest part.

              Jim.
              --
              comp.lang.javas cript FAQ - http://jibbering.com/faq/

              Comment

              • Eric Osman

                #8
                Re: axis and soap from javascript ?



                Well, it looks like I need to put on some special SOAP headers to
                successfully talk to the web service.

                *** If this is true, do I have to construct those soap headers by
                **** hand ? Or is there a javascript library I can use to
                **** do it more conveniently ?

                If I have to do it by hand, do the following errors help you help me
                figure out what I'm doing wrong ?


                If I do basically what you show below, the xml I get back looks like
                this if I don't put in any SOAP headers:

                <?xml version="1.0"?>
                <soapenv:Envelo pe
                xmlns:soapenv=" http://schemas.xmlsoap .org/soap/envelope/"
                xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
                xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance">
                <soapenv:Body >
                <soapenv:Faul t>
                <faultcode>soap env:Server.user Exception</faultcode>
                <faultstring>or g.xml.sax.SAXEx ception: Bad envelope tag:
                TEST_REQUEST</faultstring>
                <detail/>
                </soapenv:Fault>
                </soapenv:Body>
                </soapenv:Envelop e>

                If I put in a header equivalent to the one that was used for delivering
                that error message to me, I get this:

                <?xml version="1.0"?>
                <soapenv:Envelo pe
                xmlns:soapenv=" http://schemas.xmlsoap .org/soap/envelope/"
                xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
                xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance">
                <soapenv:Body >
                <soapenv:Faul t>
                <faultcode>soap env:Server.user Exception</faultcode>
                <faultstring>or g.xml.sax.SAXEx ception: SimpleDeseriali zer encountered a
                child element, which is NOT expected, in something it was trying to
                deserialize.</faultstring>
                <detail/>
                </soapenv:Fault>
                </soapenv:Body>
                </soapenv:Envelop e>


                Any ideas about this ?????

                Thanks. /Eric
                [color=blue]
                > Hi...Here's an example of using Microsoft's implimentation XMLHTTP.
                > You'll want to do a lot more reading up about it...consider going down
                > to your local full-service bookstore, or looking for a text on line, or
                > <gasp/> googling for more info...but this will get you started:
                >
                > var XMLHTTP = new ActiveXObject( 'Msxml2.XMLHTTP ' );
                >
                > var XMLRequest = new ActiveXObject( 'Msxml2.DOMDocu ment' );
                > var XMLResponse;
                >
                > var method = 'POST';
                > var async = false;
                >
                > // TODO: Change the string in the next line to whatever xml you need to
                > send...
                > var xmlString ='<root><conten t>Here is some text</content></root>';
                >
                > // TODO: Change the next line to the web address of the server you are
                > // trying to get information from
                > var url = 'http://localhost/server.asp';
                >
                > var bSuccessfullyLo aded = XMLRequest.load XML( xmlString);
                >
                > if( bSuccessfullyLo aded )
                > {
                > debugger;
                > XMLHTTP.Open( method, url, async );
                > XMLHTTP.Send( xmlString );
                > XMLResponse = XMLHTTP.respons eXML;
                >
                > if( 0 == XMLResponse.par seError.errorCo de )
                > {
                > // TODO: Do something useful here once you
                > // successfully get a response...
                > window.alert( XMLResponse.xml );
                > }
                > else
                > {
                > // TODO: Handle the parsing error here
                > window.alert('A Parse Error');
                > }
                > }
                >
                >
                > Good Luck!
                >
                > --Geoff McGrath
                >
                >[/color]

                Comment

                Working...