Java 如何向SOAP请求添加参数

Java 如何向SOAP请求添加参数,java,web-services,wsdl,sap,Java,Web Services,Wsdl,Sap,我想调用SAP中的RFC函数,我已经可以从Java发出请求并获得WSDL响应。但是我想在SOAP请求中发送一个参数?怎么做 下面的类,我使用它创建请求并获取响应: public class SOAPClientSAAJ { public static void main(String args[]) throws Exception { // Create SOAP Connection SOAPConnectionFactory soapConnect

我想调用
SAP
中的
RFC
函数,我已经可以从
Java
发出请求并获得
WSDL
响应。但是我想在SOAP请求中发送一个参数?怎么做

下面的类,我使用它创建请求并获取响应:

public class SOAPClientSAAJ {

    public static void main(String args[]) throws Exception {
        // Create SOAP Connection
        SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
        SOAPConnection soapConnection = soapConnectionFactory.createConnection();

        // Send SOAP Message to SOAP Server
        String url = "http://10.130.105.8:8000/sap/bc/.....client=520";
        SOAPMessage soapResponse = soapConnection.call(createSOAPRequest(), url);

        // print SOAP Response
        System.out.print("Response SOAP Message:");
        soapResponse.writeTo(System.out);
        soapConnection.close();
    }

    private static SOAPMessage createSOAPRequest() throws Exception {
        MessageFactory messageFactory = MessageFactory.newInstance();
        SOAPMessage soapMessage = messageFactory.createMessage();
        SOAPPart soapPart = soapMessage.getSOAPPart();

        String serverURI = "http://ws.cdyne.com/";

        // SOAP Envelope
        SOAPEnvelope envelope = soapPart.getEnvelope();
        envelope.addNamespaceDeclaration("example", serverURI);

            // SOAP Body
        SOAPBody soapBody = envelope.getBody();
        SOAPElement soapBodyElem = soapBody.addChildElement("pernr","example");

        soapBodyElem.addTextNode("10001001");

        String authorization = new String(Base64.encodeBase64(("hr_develop:unrwa2013").getBytes()));

        soapMessage.getMimeHeaders().addHeader("Authorization","Basic " + authorization);
            soapMessage.saveChanges();

        /* Print the request message */
        soapMessage.writeTo(System.out);
        System.out.println();
            return soapMessage;
    }

}

请更具体地说明您希望随请求发送的内容。您已经发送了一个SOAP正文,内容为
10001001
@Smutje是的,这是一次尝试,我不确定它是否会被正确接收。我想知道的是如何发送参数,现在如何发送标记名和名称空间。。SAP中的函数具有名为pernr的输入参数。我使用的方式正确吗?