0

i want to call a method from my html code (using jquery ajax) to a service having .wsdl as extension, that is going to return data in xml.

my html code is

my wsdl url is http://"localhost":8080/AdvanShelfWS/services/DBConnection?wsdl

when i paste this url in my browser it shows as

    <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"     xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ns="http://WebService"     xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"     xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org    /2001/XMLSchema" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"     xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org    /wsdl/soap12/"     targetNamespace="http://WebService">
<wsdl:documentation>Please Type your service description here</wsdl:documentation>
<wsdl:types>
<xs:schema attributeFormDefault="qualified" elementFormDefault="qualified"         targetNamespace="http://WebService">
<xs:element name="fnSelectAll">
<xs:complexType>
<xs:sequence/>
</xs:complexType>
</xs:element>
<xs:element name="fnSelectAllResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>

how would i call this method named "fnSelectAllResponse" what would be the url ? what would be soap request ?

currently my html code is as follows

var wsUrl = "http://"localhost":8080/WS/services/DBConnection.DBConnectionHttpSoap11Endpoint/"
var soapRequest =
'<?xml version="1.0" encoding="utf-8"?> \
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" \
xmlns:xsd="http://www.w3.org/2001/XMLSchema" \
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> \
<soap:Body> \
<fnSelectAll xmlns="http://localhost:8080/WS/services/DBConnection?wsdl"> \
</fnSelectAll> \
</soap:Body> \
</soap:Envelope>';

        $.ajax({
            type: "POST",
            url: wsUrl,
            contentType: "text/xml",
            dataType: "xml",
            data: soapRequest,
            success: function(msg){
            alert("bingo");
            },
            error: function(msg){
            alert("error");
            },
            contentType: "text/xml; charset=\"utf-8\"",

        });
tango
  • 80
  • 2
  • 11
  • I would suggest installing soapUI and run some executions against your Web Service. You will then see the HTTP traffic that is needed to drive it. From there, you can clone that in your Ajax request. – Kolban Nov 11 '14 at 17:57
  • @Kolban: while i checked this code in firebug it tells me something about CORS. – tango Nov 11 '14 at 18:01
  • Ahh that is an important clue. You now need to study about security on calling web sites through Ajax other than the one that the page itself was loaded from. Your problem is not Web Services related but rather Ajax to foreign locations in general. – Kolban Nov 11 '14 at 20:02
  • oh ok thanks, I ve read about proxy stuff to handle CORS. Can you send me workable code or link where I can call soap based service without Ajax – tango Nov 12 '14 at 03:23
  • I'd suggest googling "cors ajax jquery" and study/read what you can. If after reading you have specific and focused questions on this area, post them as new questions. – Kolban Nov 12 '14 at 04:19
  • possible duplicate of [Simplest SOAP example](http://stackoverflow.com/questions/124269/simplest-soap-example) – Paul Sweatte May 05 '15 at 13:46

0 Answers0