0

我想找出女巫一是目标名称空间,女巫一是给定WSDL文件中的方法名称。
我的WSDL文件如下:

    <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsoap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="urn:sap-com:document:sap:soap:functions:mc-style" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:n1="urn:sap-com:document:sap:rfc:functions" targetNamespace="urn:sap-com:document:sap:soap:functions:mc-style">
    <wsdl:documentation>
    <sidl:sidl xmlns:sidl="http://www.sap.com/2007/03/sidl"/>
    </wsdl:documentation>
    <wsp:UsingPolicy wsdl:required="true"/>
    <wsp:Policy wsu:Id="BN_BN_Z_CUSTOMER_LOOKUP1_BIND">
    <saptrnbnd:OptimizedXMLTransfer xmlns:saptrnbnd="http://www.sap.com/webas/710/soap/features/transportbinding/" uri="http://xml.sap.com/2006/11/esi/esp/binxml" wsp:Optional="true"/>
    <saptrnbnd:OptimizedMimeSerialization xmlns:saptrnbnd="http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization" wsp:Optional="true"/>
    <wsp:ExactlyOne xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
    <wsp:All>
    <sp:TransportBinding xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702" xmlns:sapsp="http://www.sap.com/webas/630/soap/features/security/policy" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:wst="http://docs.oasis-open.org/ws-sx/ws-trust/200512" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex">
    <wsp:Policy>
    <sp:TransportToken>
    <wsp:Policy>
    <sp:HttpsToken>
    <wsp:Policy>
    <sp:HttpBasicAuthentication/>
    </wsp:Policy>
    </sp:HttpsToken>
    </wsp:Policy>
    </sp:TransportToken>
    <sp:AlgorithmSuite>
    <wsp:Policy>
    <sp:Basic128Rsa15/>
    </wsp:Policy>
    </sp:AlgorithmSuite>
    <sp:Layout>
    <wsp:Policy>
    <sp:Strict/>
    </wsp:Policy>
    </sp:Layout>
    </wsp:Policy>
    </sp:TransportBinding>
    </wsp:All>
    </wsp:ExactlyOne>
    <wsaw:UsingAddressing xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" wsp:Optional="true"/>
    </wsp:Policy>
    <wsp:Policy wsu:Id="BN_BN_Z_CUSTOMER_LOOKUP1_BIND_SOAP12">
    <saptrnbnd:OptimizedXMLTransfer xmlns:saptrnbnd="http://www.sap.com/webas/710/soap/features/transportbinding/" uri="http://xml.sap.com/2006/11/esi/esp/binxml" wsp:Optional="true"/>
    <saptrnbnd:OptimizedMimeSerialization xmlns:saptrnbnd="http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization" wsp:Optional="true"/>
    <wsp:ExactlyOne xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
    <wsp:All>
    <sp:TransportBinding xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702" xmlns:sapsp="http://www.sap.com/webas/630/soap/features/security/policy" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:wst="http://docs.oasis-open.org/ws-sx/ws-trust/200512" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex">
    <wsp:Policy>
    <sp:TransportToken>
    <wsp:Policy>
    <sp:HttpsToken>
    <wsp:Policy>
    <sp:HttpBasicAuthentication/>
    </wsp:Policy>
    </sp:HttpsToken>
    </wsp:Policy>
    </sp:TransportToken>
    <sp:AlgorithmSuite>
    <wsp:Policy>
    <sp:Basic128Rsa15/>
    </wsp:Policy>
    </sp:AlgorithmSuite>
    <sp:Layout>
    <wsp:Policy>
    <sp:Strict/>
    </wsp:Policy>
    </sp:Layout>
    </wsp:Policy>
    </sp:TransportBinding>
    </wsp:All>
    </wsp:ExactlyOne>
    <wsaw:UsingAddressing xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" wsp:Optional="true"/>
    </wsp:Policy>
    <wsp:Policy wsu:Id="IF_IF_Z_CUSTOMER_LOOKUP1">
    <sapsession:Session xmlns:sapsession="http://www.sap.com/webas/630/soap/features/session/">
    <sapsession:enableSession>false</sapsession:enableSession>
    </sapsession:Session>
    <sapcentraladmin:CentralAdministration xmlns:sapcentraladmin="http://www.sap.com/webas/700/soap/features/CentralAdministration/" wsp:Optional="true">
    <sapcentraladmin:BusinessApplicationID>0018FE7972821DEFB0CD97950B095362</sapcentraladmin:BusinessApplicationID>
    </sapcentraladmin:CentralAdministration>
    </wsp:Policy>
    <wsp:Policy wsu:Id="OP_IF_OP_Z_GET_CUST_GEN">
    <sapcomhnd:enableCommit xmlns:sapcomhnd="http://www.sap.com/NW05/soap/features/commit/">false</sapcomhnd:enableCommit>
    <sapblock:enableBlocking xmlns:sapblock="http://www.sap.com/NW05/soap/features/blocking/">true</sapblock:enableBlocking>
    <saptrhnw05:required xmlns:saptrhnw05="http://www.sap.com/NW05/soap/features/transaction/">no</saptrhnw05:required>
    <saprmnw05:enableWSRM xmlns:saprmnw05="http://www.sap.com/NW05/soap/features/wsrm/">false</saprmnw05:enableWSRM>
    </wsp:Policy>
    <wsdl:types>
    <xsd:schema attributeFormDefault="qualified" targetNamespace="urn:sap-com:document:sap:rfc:functions">
    <xsd:simpleType name="char10">
    <xsd:restriction base="xsd:string">
    <xsd:maxLength value="10"/>
    </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="char3">
    <xsd:restriction base="xsd:string">
    <xsd:maxLength value="3"/>
    </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="char35">
    <xsd:restriction base="xsd:string">
    <xsd:maxLength value="35"/>
    </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="char40">
    <xsd:restriction base="xsd:string">
    <xsd:maxLength value="40"/>
    </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="lang">
    <xsd:restriction base="xsd:string">
    <xsd:maxLength value="1"/>
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:schema>
    <xsd:schema xmlns:n0="urn:sap-com:document:sap:rfc:functions" attributeFormDefault="qualified" targetNamespace="urn:sap-com:document:sap:soap:functions:mc-style">
    <xsd:import namespace="urn:sap-com:document:sap:rfc:functions"/>
    <xsd:complexType name="ZcustomerSt">
    <xsd:sequence>
    <xsd:element name="Kunnr" type="n0:char10"/>
    <xsd:element name="Name1" type="n0:char35"/>
    <xsd:element name="City" type="n0:char35"/>
    <xsd:element name="Land" type="n0:char3"/>
    <xsd:element name="Pstlz" type="n0:char10"/>
    </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="ZcustomerTt">
    <xsd:sequence>
    <xsd:element name="item" type="tns:ZcustomerSt" minOccurs="0" maxOccurs="unbounded"/>
    </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="Z_GET_CUST_GEN">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="Input" type="n0:char40" minOccurs="0"/>
    <xsd:element name="Langu" type="n0:lang" minOccurs="0"/>
    <xsd:element name="Max" type="xsd:int" minOccurs="0"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="Z_GET_CUST_GENResponse">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="ZCustGen" type="tns:ZcustomerTt"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>
    </wsdl:types>
    <wsdl:message name="Z_GET_CUST_GEN">
    <wsdl:part name="parameters" element="tns:Z_GET_CUST_GEN"/>
    </wsdl:message>
    <wsdl:message name="Z_GET_CUST_GENResponse">
    <wsdl:part name="parameter" element="tns:Z_GET_CUST_GENResponse"/>
    </wsdl:message>
    <wsdl:portType name="Z_CUSTOMER_LOOKUP1">
    <wsdl:documentation>
    <sapdoc:sapdoc xmlns:sapdoc="urn:sap:esi:documentation">
    <sapdoc:docitem docURL="http://NW73-BI-PC.ecc.corp:8000/sap/bc/esdt/docu/sd_text?sap-client=800&sd_name=Z_CUSTOMER_LOOKUP1"/>
    </sapdoc:sapdoc>
    </wsdl:documentation>
    <wsp:Policy>
    <wsp:PolicyReference URI="#IF_IF_Z_CUSTOMER_LOOKUP1"/>
    </wsp:Policy>
    <wsdl:operation name="Z_GET_CUST_GEN">
    <wsp:Policy>
    <wsp:PolicyReference URI="#OP_IF_OP_Z_GET_CUST_GEN"/>
    </wsp:Policy>
    <wsdl:input message="tns:Z_GET_CUST_GEN"/>
    <wsdl:output message="tns:Z_GET_CUST_GENResponse"/>
    </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="Z_CUSTOMER_LOOKUP1_BIND" type="tns:Z_CUSTOMER_LOOKUP1">
    <wsp:Policy>
    <wsp:PolicyReference URI="#BN_BN_Z_CUSTOMER_LOOKUP1_BIND"/>
    </wsp:Policy>
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
    <wsdl:operation name="Z_GET_CUST_GEN">
    <soap:operation style="document"/>
    <wsdl:input>
    <soap:body use="literal"/>
    </wsdl:input>
    <wsdl:output>
    <soap:body use="literal"/>
    </wsdl:output>
    </wsdl:operation>
    </wsdl:binding>
    <wsdl:binding name="Z_CUSTOMER_LOOKUP1_BIND_SOAP12" type="tns:Z_CUSTOMER_LOOKUP1">
    <wsp:Policy>
    <wsp:PolicyReference URI="#BN_BN_Z_CUSTOMER_LOOKUP1_BIND_SOAP12"/>
    </wsp:Policy>
    <wsoap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
    <wsdl:operation name="Z_GET_CUST_GEN">
    <wsoap12:operation style="document"/>
    <wsdl:input>
    <wsoap12:body use="literal"/>
    </wsdl:input>
    <wsdl:output>
    <wsoap12:body use="literal"/>
    </wsdl:output>
    </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="Z_CUSTOMER_LOOKUP1">
    <wsdl:port name="Z_CUSTOMER_LOOKUP1_BIND" binding="tns:Z_CUSTOMER_LOOKUP1_BIND">
    <soap:address location="http://NW73-BI-http://**********:******/sap/bc/srt/rfc/sap/z_customer_lookup1/800/z_customer_lookup1/z_customer_lookup1_bind"/>
    </wsdl:port>
    <wsdl:port name="Z_CUSTOMER_LOOKUP1_BIND_SOAP12" binding="tns:Z_CUSTOMER_LOOKUP1_BIND_SOAP12">
    <wsoap12:address location="http://**********:******/sap/bc/srt/rfc/sap/z_customer_lookup1/800/z_customer_lookup1/z_customer_lookup1_bind"/>
    </wsdl:port>
    </wsdl:service>
    </wsdl:definitions>

通过使用上面WSDL的代码,我编写了以下代码来调用 Android 中的 SOAP WebService:

package com.venkattt.pack;

import java.net.SocketException;

import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;

import android.app.Activity;
import android.os.Bundle;

public class SoapWebservicesExampleActivity extends Activity {
    /** Called when the activity is first created. */
      final String NAMESPACE = "urn:sap-com:document:sap:rfc:functions";
     final String URL = "http://**********:******/sap/bc/srt/wsdl/srvc_14DAE9C8D79F1EE196F1FC6C6518A345/wsdl11/allinone/ws_policy/document?sap-client=800&sap-user=********&sap-password=********";
      final String METHOD_NAME = "Z_GET_CUST_GEN";
     final String SOAP_ACTION = "urn:sap-com:document:sap:rfc:functions/Z_GET_CUST_GEN";
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

            SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);// set up
            request.addProperty("Langu", "d");
            SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER12); // put all required data into a soap
            envelope.dotNet = false;
            envelope.setOutputSoapObject(request);
            HttpTransportSE httpTransport = new HttpTransportSE(URL);
            httpTransport.debug = true; 
            try {
                             httpTransport.call(SOAP_ACTION, envelope);
                 //Object result = (Object) envelope.getResponse();

                 SoapObject result=(SoapObject) envelope.bodyIn;

                 for(int i=0; i<result.getPropertyCount(); i++)
                 {
                    SoapObject obj3 =(SoapObject) result.getProperty(0);
                    System.out.println("theeeeeeeeee"+obj3);

                 }
                                 }
            catch(SocketException ex){
                    ex.printStackTrace();
                } catch (Exception e) {
                   e.printStackTrace();
                }
        }
    }  

当我运行这个示例时,我的应用程序进入调试模式

SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);  

我如何通过在 Android 中调用此服务。
提前致谢。

4

1 回答 1

1

您的目标命名空间是:

targetNamespace="urn:sap-com:document:sap:rfc:functions"  

方法是 _

"Z_GET_CUST_GEN"  
于 2012-08-18T05:08:36.193 回答