S
sonic_soul
Hi,
I was curious if I could make my webservice work with firefox client
webservice functionality. (i got it to work with webservice.htc)
I am able to get firefox to see my serverside web service methods
(instantiate a proxy and alert proxy.MyMethod to tell its a valid
function), but when I submit to them, I either get, "Cannot convert
javascript arg 0" or "not enough arguments" javascript errors. I am
thinking that perhaps firefox does not understand auto generated WSDL.
I do not have much experience with WSDL and so perhaps someone has
attempted such feat....
FireFoxTest.aspx
<script>
var proxy = null;
var wsdl_uri = "http://localhost/webtesting/service.xml";
function run (aValue1, aValue2)
{
if (!proxy) {
var listener = {
onLoad: function (aProxy)
{
proxy = aProxy;
proxy.setListener(listener);
requestTranslation(aValue1, aValue2);
},
onError: function (aError)
{
alert(aError);
},
MyMathCallback : function (val)
{
alert('inside callback');
alert(val);
}
};
createProxy(listener);
}
else {
requestTranslation(aValue1, aValue2);
}
}
function createProxy(aCreationListener)
{
try {
var factory = new WebServiceProxyFactory();
factory.createProxyAsync(wsdl_uri, "MyMathSoap", "", true,
aCreationListener);
}
catch (ex) {
alert(ex);
}
}
function requestTranslation (value1, value2)
{
if (proxy) {
alert(proxy.Add);
proxy.Add();
}
else {
alert("Error: Proxy set up not complete!");
}
}
</script>
</head>
<body MS_POSITIONING="GridLayout">
firefox version<br><br>
<form id="Form1" method="post" runat="server">
<a href="javascript:;" onclick="run(2,7);">run</a>
WSDL:
<?xml version="1.0" encoding="utf-8"?>
<definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:s0="http://tempuri.org/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
targetNamespace="http://tempuri.org/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<s:schema elementFormDefault="qualified"
targetNamespace="http://tempuri.org/">
<s:element name="Add">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="n1"
type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="n2"
type="s:int" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="AddResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="AddResult"
type="s:int" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetTest">
<s:complexType />
</s:element>
<s:element name="GetTestResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1"
name="GetTestResult" type="s0:TestObject" />
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="TestObject">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Name"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Caption"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="InnerObject"
type="s0:TestInnerObject" />
</s:sequence>
</s:complexType>
<s:complexType name="TestInnerObject">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="InnerValue"
type="s:string" />
</s:sequence>
</s:complexType>
</s:schema>
</types>
<message name="AddSoapIn">
<part name="parameters" element="s0:Add" />
</message>
<message name="AddSoapOut">
<part name="parameters" element="s0:AddResponse" />
</message>
<message name="GetTestSoapIn">
<part name="parameters" element="s0:GetTest" />
</message>
<message name="GetTestSoapOut">
<part name="parameters" element="s0:GetTestResponse" />
</message>
<portType name="MyMathSoap">
<operation name="Add">
<input message="s0:AddSoapIn" />
<output message="s0:AddSoapOut" />
</operation>
<operation name="GetTest">
<input message="s0:GetTestSoapIn" />
<output message="s0:GetTestSoapOut" />
</operation>
</portType>
<binding name="MyMathSoap" type="s0:MyMathSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />
<operation name="Add">
<soapperation soapAction="http://tempuri.org/Add"
style="document" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
<operation name="GetTest">
<soapperation soapAction="http://tempuri.org/GetTest"
style="document" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
</binding>
<service name="MyMath">
<port name="MyMathSoap" binding="s0:MyMathSoap">
<soap:address location="http://localhost/webtesting/testwebservice.asmx"
/>
</port>
</service>
</definitions>
I was curious if I could make my webservice work with firefox client
webservice functionality. (i got it to work with webservice.htc)
I am able to get firefox to see my serverside web service methods
(instantiate a proxy and alert proxy.MyMethod to tell its a valid
function), but when I submit to them, I either get, "Cannot convert
javascript arg 0" or "not enough arguments" javascript errors. I am
thinking that perhaps firefox does not understand auto generated WSDL.
I do not have much experience with WSDL and so perhaps someone has
attempted such feat....
FireFoxTest.aspx
<script>
var proxy = null;
var wsdl_uri = "http://localhost/webtesting/service.xml";
function run (aValue1, aValue2)
{
if (!proxy) {
var listener = {
onLoad: function (aProxy)
{
proxy = aProxy;
proxy.setListener(listener);
requestTranslation(aValue1, aValue2);
},
onError: function (aError)
{
alert(aError);
},
MyMathCallback : function (val)
{
alert('inside callback');
alert(val);
}
};
createProxy(listener);
}
else {
requestTranslation(aValue1, aValue2);
}
}
function createProxy(aCreationListener)
{
try {
var factory = new WebServiceProxyFactory();
factory.createProxyAsync(wsdl_uri, "MyMathSoap", "", true,
aCreationListener);
}
catch (ex) {
alert(ex);
}
}
function requestTranslation (value1, value2)
{
if (proxy) {
alert(proxy.Add);
proxy.Add();
}
else {
alert("Error: Proxy set up not complete!");
}
}
</script>
</head>
<body MS_POSITIONING="GridLayout">
firefox version<br><br>
<form id="Form1" method="post" runat="server">
<a href="javascript:;" onclick="run(2,7);">run</a>
WSDL:
<?xml version="1.0" encoding="utf-8"?>
<definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:s0="http://tempuri.org/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
targetNamespace="http://tempuri.org/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<s:schema elementFormDefault="qualified"
targetNamespace="http://tempuri.org/">
<s:element name="Add">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="n1"
type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="n2"
type="s:int" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="AddResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="AddResult"
type="s:int" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetTest">
<s:complexType />
</s:element>
<s:element name="GetTestResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1"
name="GetTestResult" type="s0:TestObject" />
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="TestObject">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Name"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Caption"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="InnerObject"
type="s0:TestInnerObject" />
</s:sequence>
</s:complexType>
<s:complexType name="TestInnerObject">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="InnerValue"
type="s:string" />
</s:sequence>
</s:complexType>
</s:schema>
</types>
<message name="AddSoapIn">
<part name="parameters" element="s0:Add" />
</message>
<message name="AddSoapOut">
<part name="parameters" element="s0:AddResponse" />
</message>
<message name="GetTestSoapIn">
<part name="parameters" element="s0:GetTest" />
</message>
<message name="GetTestSoapOut">
<part name="parameters" element="s0:GetTestResponse" />
</message>
<portType name="MyMathSoap">
<operation name="Add">
<input message="s0:AddSoapIn" />
<output message="s0:AddSoapOut" />
</operation>
<operation name="GetTest">
<input message="s0:GetTestSoapIn" />
<output message="s0:GetTestSoapOut" />
</operation>
</portType>
<binding name="MyMathSoap" type="s0:MyMathSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />
<operation name="Add">
<soapperation soapAction="http://tempuri.org/Add"
style="document" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
<operation name="GetTest">
<soapperation soapAction="http://tempuri.org/GetTest"
style="document" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
</binding>
<service name="MyMath">
<port name="MyMathSoap" binding="s0:MyMathSoap">
<soap:address location="http://localhost/webtesting/testwebservice.asmx"
/>
</port>
</service>
</definitions>