首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在html5网页iPad中使用jQueryAjax使用SAP soap web服务

在html5网页iPad中使用jQueryAjax使用SAP soap web服务
EN

Stack Overflow用户
提问于 2011-04-22 18:19:55
回答 1查看 7.2K关注 0票数 0

我已经在xcode框架中为iPad上的SAP做了申请。使用web视图方法,我可以在iPad中打开我的应用程序网页。html5页面存储在我的pc上。我的问题是如何通过html5网页使用SAP SOAP web服务。我应该先做哪些步骤?我有访问SAP的ES工作场所。我没有任何想法,因为这是我的第一个项目。有人可以给我提供适当的视频教程或具体的链接来阅读。大多数链接都是针对REST风格的web服务的。提前谢谢。我的web服务url是"http://erp.esworkplace.sap.com/sap/bc/srt/wsdl/bndg_DF5300E043F279F18F0400145E5ADE89/wsdl11/allinone/ws_policy/document?sap-client=800“,它以wsdl格式打开。和"MaterialBasicDataByIDQueryResponse_In“这是我的函数名

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-04-27 19:34:35

我强烈推荐REST!它的重量轻多了

在本例中,我在您的html页面中使用了jQuery

代码语言:javascript
复制
<script id="soap-template" type="application/soap-template"> <?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><ns0:getSOAP xmlns:ns0="http://localhost:8080/soap"> <search>${id}</search></ns0:getSOAP ></soap:Body></soap:Envelope></script>

JS:

代码语言:javascript
复制
var soapBody = $("#soap-template").html().replace(
        new RegExp( "\\$\\{[^}]+\\}", "i" ),
        search
        );
soapBody = $.trim( soapBody );
$.ajax({
    type: "post",
    url: "http://localhost:8080/soap",
    contentType: "text/xml",
    data: soapBody,
    dataType: "xml",
    processData: false,
    beforeSend: function( xhr ){
    // Pass the target URL onto the proxy.
    xhr.setRequestHeader(
    "SOAPTarget",
    "http://localhost:8080/soap"
    );

    // Pass the action onto the proxy.
    xhr.setRequestHeader(
    "SOAPAction",
    "http://localhost:8080/soap/getSOAP"
    );
    },
    success: function( response ){
    // Get a jQuery-ized version of the response.
    var xml = $( response );
    //handle your result

    },
    error: function(){
        alert("error");
    console.log( "ERROR", arguments );
    }
    });
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5754463

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档