All pastes #159 Raw Edit

adude

public text v1 · immutable
#159 ·published 2004-05-17 18:09 UTC
rendered paste body


import org.apache.axis.encoding.XMLType;
import java.util.*;
import javax.xml.rpc.*;
import org.apache.axis.message.*;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.namespace.QName;
import java.io.*;
 
public class AxisTest2 {
 
    /*
 
The Following Code produces:
&lt?xml version="1.0" encoding="UTF-8"?&gt
&ltsoapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w
3.org/2001/XMLSchema-instance"&gt
 &ltsoapenv:Body&gt
  &ltRateRequest xmlns="http://www.whatever.org/"/&gt
 &lt/soapenv:Body&gt
&lt/soapenv:Envelope&gt
 
HOWEVER, the following is what was expected:
&lt?xml version="1.0" encoding="UTF-8"?&gt
&ltsoapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w
3.org/2001/XMLSchema-instance"&gt
 &ltsoapenv:Body&gt
  &ltRateRequest xmlns="http://www.whatever.org/"&gt
    &ltPOS&gt
      &ltSource&gt
        &ltUniqueId Type="IDNUM" Id="12345"/&gt
      &lt/Source&gt
    &lt/POS&gt
  &lt/RateRequest
 &lt/soapenv:Body&gt
&lt/soapenv:Envelope&gt
 
 
WHAT IS WRONG?  WHY is the xmlFromDom4j not utilized?
  */
 
    public static void main(String [] args) throws Exception{
        Service  service = new Service();
        Call     call    = (Call) service.createCall(); 
        call.setTargetEndpointAddress(new java.net.URL("http://www.carrentals.com/servlet/RequestTest"));
        call.setOperationStyle("document");
        call.setOperationName("OTA_VehAvailRateRQ");
        RPCElement element=new RPCElement("RateRequest");
        element.setNamespaceURI("http://www.whatever.org/");
        String xmlFromDom4j="&ltPOS&gt&ltSource&gt&ltUniqueId Type=\"IDNUM\" Id=\"12345\"/&gt&lt/Source&gt&lt/POS&gt";
        org.apache.axis.message.Text textElement=new Text(xmlFromDom4j); 
        textElement.setParentElement(element);
        call.invoke(element);
    }
}