如何轻松测试Spring.io Web服务教程示例!用javascript或ajax或

时间:2014-02-09 13:14:23

标签: java javascript ajax spring web-services

我正在尝试学习特别是那些用于SOAP的Web服务。我喜欢春天!我从这里阅读教程!

http://docs.spring.io/spring-ws/sites/2.0/reference/html/tutorial.html

已经尝试了一些Ajax代码,但没有真正出现! 这个soap测试消息是由soapUI生成的,效果很好!

    function callsoap()
{


var soapMessage =
'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"\
xmlns:sch="http://mycompany.com/hr/schemas">\
<soapenv:Header/>\
<soapenv:Body>\
  <sch:HolidayRequest>\
    <sch:Holiday>\
        <sch:StartDate>2006-07-03</sch:StartDate>\
        <sch:EndDate>2006-07-04</sch:EndDate>\
     </sch:Holiday>\
     <sch:Employee>\
        <sch:Number>32</sch:Number>\
        <sch:FirstName>ee</sch:FirstName>\
        <sch:LastName>dd</sch:LastName>\
     </sch:Employee>\
  </sch:HolidayRequest>\
</soapenv:Body>\
</soapenv:Envelope>';

$.ajax( "http://localhost:8080/holidayService/holidayService", {

contentType: "application/soap+xml; charset=utf-8",
type: "POST", //important
dataType: "xml",
data: soapMessage

});

alert("Called Soap!"); 

}

1 个答案:

答案 0 :(得分:0)

SoapUI是最好的,如果有人来这里寻找测试工具!!!