Esempio n. 1
0
 private void writeBody(XmlOutputStream xout, QName requestElement, XMLizable request)
     throws IOException {
   xout.writeStartTag(Constants.SOAP_ENVELOPE_NS, "Body");
   xout.setPrefix("m", requestElement.getNamespaceURI());
   if (objectNamespace != null) xout.setPrefix("sobj", objectNamespace);
   request.write(requestElement, xout, typeMapper);
   xout.writeEndTag(Constants.SOAP_ENVELOPE_NS, "Body");
 }
Esempio n. 2
0
  private void writeHeaders(XmlOutputStream xout) throws IOException {
    xout.writeStartTag(Constants.SOAP_ENVELOPE_NS, "Header");

    for (Map.Entry<QName, Object> entry : headers.entrySet()) {
      xout.setPrefix(null, entry.getKey().getNamespaceURI());
      Object value = entry.getValue();

      if (value instanceof XMLizable) {
        ((XMLizable) value).write(entry.getKey(), xout, typeMapper);
      } else {
        // todo: add simple type
      }
    }

    xout.writeEndTag(Constants.SOAP_ENVELOPE_NS, "Header");
  }
Esempio n. 3
0
  private void sendRequest(OutputStream out, XMLizable request, QName requestElement)
      throws IOException {
    XmlOutputStream xout = new XmlOutputStream(out, config.isPrettyPrintXml());
    xout.startDocument();

    xout.setPrefix("env", Constants.SOAP_ENVELOPE_NS);
    xout.setPrefix("xsd", Constants.SCHEMA_NS);
    xout.setPrefix("xsi", Constants.SCHEMA_INSTANCE_NS);

    xout.writeStartTag(Constants.SOAP_ENVELOPE_NS, "Envelope");

    if (headers.size() > 0) {
      writeHeaders(xout);
    }

    writeBody(xout, requestElement, request);

    xout.writeEndTag(Constants.SOAP_ENVELOPE_NS, "Envelope");

    xout.endDocument();
    xout.close();
  }