How to get payload object from SOAP Logical Handler

前端 未结 2 400
醉话见心
醉话见心 2021-01-03 14:30

I am learning how to create Logical Handlers in JAX-WS SOAP web services. Here I am trying to get the payload data and want to print that for testing. But I am getting issue

相关标签:
2条回答
  • 2021-01-03 15:19

    Source payload = message.getPayload();

    then convert the DomSource object to string by using xmltransformation or some other way , it will give you the payload.

    0 讨论(0)
  • 2021-01-03 15:21

    As @curious said, use

    Source payload = message.getPayload();
    

    Sample code for convert the DomSource object to string by using xmltransformation is like this :

    StringWriter sw = new StringWriter();
    Transformer transformer = TransformerFactory.newInstance().newTransformer();
    Result output = new StreamResult( sw );
    transformer.transform( payload, output );
    System.out.println("Response : "+sw.toString());
    
    0 讨论(0)
提交回复
热议问题