Java 从SOAP请求中查找方法名称

Java 从SOAP请求中查找方法名称,java,soap,Java,Soap,我有SOAP请求XML,我想从中找到方法名。我使用了下面的代码,但是SOAP主体总是声明null,如果我得到了SOAP主体,那么imediate下一个子对象将是方法名。如何解决这个问题 String xml1 = "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://s

我有SOAP请求XML,我想从中找到方法名。我使用了下面的代码,但是SOAP主体总是声明null,如果我得到了SOAP主体,那么imediate下一个子对象将是方法名。如何解决这个问题

String xml1 = "<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>"+
"<ConversionRate xmlns=\"http://www.webserviceX.NET/\">"+
  "<FromCurrency>AFA</FromCurrency>"+
  "<ToCurrency>TRY</ToCurrency>"+
"</ConversionRate>"+
"</soap:Body>"+
"</soap:Envelope>";

InputStream is = new ByteArrayInputStream(xml1.getBytes());
SOAPMessage soapMessage = MessageFactory.newInstance().createMessage(null, is);
SOAPBody body = soapMessage.getSOAPBody();
System.out.println(body);
String xml1=“”+
""+
""+
“AFA”+
“试试看”+
""+
""+
"";
InputStream is=newbytearrayinputstream(xml1.getBytes());
SOAPMessage SOAPMessage=MessageFactory.newInstance().createMessage(null,is);
SOAPBody=soapMessage.getSOAPBody();
系统输出打印项次(正文);
找到了答案

       body.getChildNodes().item(0).getNodeName() 

这将给出找到答案的方法名

。body.getChildNodes().item(0).getNodeName()这将给出方法名称。太好了,请将其作为答案发布,然后接受它-这将标记问题为已结束,并帮助未来的查看者找到答案。