I generated a web service using eclipse the methods appends a new record in the xml file. here is the generated wsdl… and the html code. But this isnt working fine… I have tested the wsdl it is ok… i think i am struck at the soap message SOAPACTION attribute…
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://DefaultNamespace" xmlns:intf="http://DefaultNamespace" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://DefaultNamespace">
<!--WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)-->
<wsdl:types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://DefaultNamespace">
<element name="addStudentDetailsXml">
<complexType>
<sequence>
<element name="sname" type="xsd:string"/>
<element name="sage" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="addStudentDetailsXmlResponse">
<complexType/>
</element>
</schema>
</wsdl:types>
<wsdl:message name="addStudentDetailsXmlRequest">
<wsdl:part element="impl:addStudentDetailsXml" name="parameters"/>
</wsdl:message>
<wsdl:message name="addStudentDetailsXmlResponse">
<wsdl:part element="impl:addStudentDetailsXmlResponse" name="parameters"/>
</wsdl:message>
<wsdl:portType name="StudentList">
<wsdl:operation name="addStudentDetailsXml">
<wsdl:input message="impl:addStudentDetailsXmlRequest" name="addStudentDetailsXmlRequest"/>
<wsdl:output message="impl:addStudentDetailsXmlResponse" name="addStudentDetailsXmlResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="StudentListSoapBinding" type="impl:StudentList">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="addStudentDetailsXml">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="addStudentDetailsXmlRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="addStudentDetailsXmlResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="StudentListService">
<wsdl:port binding="impl:StudentListSoapBinding" name="StudentList">
<wsdlsoap:address location="http://localhost:8080/WebServiceProject/services/StudentList"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
this is my html
<html>
<head>
<script language="javascript">
function StoreData()
{
alert("function called");
var a=document.form1.name.value;
var b=document.form1.age.value;
var soapaction = "http://StudentList";
var req = "<soapenv:Envelope xmlns:soapenv=\\"http://schemas.xmlsoap.org/soap/envelope/\\" ><soapenv:Body><web:addStudentDetailsXml><sname>"+a+"</sname><sage>"+b+"</sage></web:addStudentDetailsXml></soapenv:Body></soapenv:Envelope>";
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
var reqXML = xmlDoc.loadXML(req);
alert(reqXML.xml);
var xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
alert(xmlhttp.responseXML.xml);
}
}
xmlhttp.open("POST","http://localhost:8080/WebServiceProject/services/StudentList",true);
xmlhttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xmlhttp.setRequestHeader("SOAPAction", soapaction);
xmlhttp.send(req);
}
</script>
</head>
<body>
<form name=form1 method="post">
<table>
<tr>
<td><label>Name:</label></td>
<td><input type="text" name="name" /></td></tr>
<tr><td><label>Age:</label></td>
<td><input type="text" name="age" /></td></tr>
<tr><td align="center"><input type="submit" value="post" onclick="StoreData()"/></td>
<td align="center"><input type="reset" value="clear" ></td></tr>
</table>
</form>
</body>
</html>
please help