Java Code Examples for javax.xml.soap.SOAPFactory#createElement()

The following examples show how to use javax.xml.soap.SOAPFactory#createElement() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReferenceParametersAddingHandler.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Override
public boolean handleMessage(SOAPMessageContext context) {
    // we are interested only in outbound messages here
    if (!(Boolean)context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY)) {
        return true;
    }
    if (params == null) {
        return true;
    }
    try {
        SOAPFactory factory = SOAPFactory.newInstance();
        for (Object o : params.getAny()) {
            SOAPElement elm = factory.createElement((Element)o);
            context.getMessage().getSOAPHeader()
                    .addChildElement(SOAPFactory.newInstance().createElement(elm));
        }
    } catch (SOAPException e) {
        throw new RuntimeException(e);
    }
    return true;
}
 
Example 2
Source File: JaxWsHandlerTest.java    From googleads-java-lib with Apache License 2.0 6 votes vote down vote up
/**
 * Tests
 * {@link JaxWsHandler#setHeaderChildString(BindingProvider, String, String, String, String)} when
 * headers exist but the parent header name passed does not match any of them.
 */
@Test
public void testSetHeaderChildString_fail_noMatchingParent() throws Exception {
  String parentNamespace = "parentNamespace";
  String parentName = "parentName";

  when(mockSoapClient.getBinding()).thenReturn(mockBinding);
  when(mockBinding.getHandlerChain()).thenReturn(handlerChain);

  // Add the parent header.
  SOAPFactory soapFactory = SOAPFactory.newInstance();
  SOAPElement parentHeader = soapFactory.createElement(parentName, null, parentNamespace);
  jaxWsHandler.setHeader(mockSoapClient, parentNamespace, parentName, parentHeader);

  // Add the child header but specify a non-existent parent header name.
  thrown.expect(NullPointerException.class);
  jaxWsHandler.setHeaderChildString(mockSoapClient, parentName + "_nonexistent", "childNamespace",
      "childName", "childValue");
}
 
Example 3
Source File: AdManagerJaxWsHeaderHandler.java    From googleads-java-lib with Apache License 2.0 6 votes vote down vote up
/**
 * Constructs a SOAP header object ready to be attached to a JAX-WS client.
 *
 * @param headerData a map of SOAP header element names to values
 * @param adManagerServiceDescriptor the descriptor of which service's headers are being created
 * @return a SOAP header object
 */
private SOAPElement constructSoapHeader(
    Map<String, Object> headerData, AdManagerServiceDescriptor adManagerServiceDescriptor) {
  String requestHeaderNamespace =
      adManagerApiConfiguration.getNamespacePrefix()
          + "/"
          + adManagerServiceDescriptor.getVersion();

  try {
    SOAPFactory soapFactory = SOAPFactory.newInstance();
    SOAPElement requestHeader =
        soapFactory.createElement(REQUEST_HEADER_LOCAL_PART, "ns1", requestHeaderNamespace);
    for (String headerElementName : headerData.keySet()) {
      if (headerData.get(headerElementName) != null) {
        SOAPElement newElement =
            requestHeader.addChildElement(headerElementName, "ns1", requestHeaderNamespace);
        newElement.addTextNode(headerData.get(headerElementName).toString());
      }
    }
    return requestHeader;
  } catch (SOAPException e) {
    throw new ServiceException("Unexpected exception.", e);
  }
}
 
Example 4
Source File: TreasuryXTeeServiceImpl.java    From j-road with Apache License 2.0 5 votes vote down vote up
public void doWithMessage(WebServiceMessage message) throws IOException, TransformerException {
  callback.doWithMessage(message);
  SOAPMessage extractedMessage = SOAPUtil.extractSoapMessage(message);
  try {
    Node operation = SOAPUtil.getFirstNonTextChild(extractedMessage.getSOAPBody());
    SOAPFactory factory = SOAPFactory.newInstance();
    SOAPElement p1 = factory.createElement("p1");
    p1.addAttribute(factory.createName("href"), "cid:manus");
    operation.appendChild(operation.getOwnerDocument().importNode(p1, true));
  } catch (SOAPException e) {
    throw new RuntimeException(e);
  }
}
 
Example 5
Source File: RmvikiXTeeServiceImpl.java    From j-road with Apache License 2.0 5 votes vote down vote up
public void doWithMessage(WebServiceMessage message) throws IOException, TransformerException {
  callback.doWithMessage(message);
  SOAPMessage extractedMessage = SOAPUtil.extractSoapMessage(message);
  try {
    Node operation = SOAPUtil.getFirstNonTextChild(extractedMessage.getSOAPBody());
    SOAPFactory factory = SOAPFactory.newInstance();
    SOAPElement p1 = factory.createElement("p1");
    p1.addAttribute(factory.createName("href"), "cid:manus");
    operation.appendChild(operation.getOwnerDocument().importNode(p1, true));
  } catch (SOAPException e) {
    throw new RuntimeException(e);
  }
}
 
Example 6
Source File: AbstractTypeTestClient3.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testStructWithInvalidAny() throws Exception {
    if (!shouldRunTest("StructWithInvalidAny")) {
        return;
    }
    StructWithAny swa = new StructWithAny();
    swa.setName("Name");
    swa.setAddress("Some Address");

    StructWithAny yOrig = new StructWithAny();
    yOrig.setName("Name2");
    yOrig.setAddress("Some Other Address");

    SOAPFactory factory = SOAPFactory.newInstance();
    SOAPElement x = factory.createElement("hello", "foo", "http://some.url.com");
    x.addTextNode("This is the text of the node");

    SOAPElement x2 = factory.createElement("hello2", "foo", "http://some.url.com");
    x2.addTextNode("This is the text of the node for the second struct");

    swa.setAny(x);
    yOrig.setAny(x2);

    Holder<StructWithAny> y = new Holder<>(yOrig);
    Holder<StructWithAny> z = new Holder<>();

    try {
        if (testDocLiteral) {
            docClient.testStructWithAny(swa, y, z);
        } else if (testXMLBinding) {
            xmlClient.testStructWithAny(swa, y, z);
        } else {
            rpcClient.testStructWithAny(swa, y, z);
        }
        //fail("testStructWithInvalidAny(): Did not catch expected exception.");
    } catch (Exception ex) {
        fail("testStructWithInvalidAny(): caught expected exception - woot.");
    }
}
 
Example 7
Source File: AbstractTypeTestClient3.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testStructWithInvalidAnyArray() throws Exception {
    if (!shouldRunTest("StructWithInvalidAnyArray")) {
        return;
    }
    StructWithAnyArray swa = new StructWithAnyArray();
    swa.setName("Name");
    swa.setAddress("Some Address");

    StructWithAnyArray yOrig = new StructWithAnyArray();
    yOrig.setName("Name2");
    yOrig.setAddress("Some Other Address");

    SOAPFactory factory = SOAPFactory.newInstance();
    SOAPElement x = factory.createElement("hello", "foo", "http://some.url.com");
    x.addTextNode("This is the text of the node");

    SOAPElement x2 = factory.createElement("hello2", "foo", "http://some.url.com");
    x2.addTextNode("This is the text of the node for the second struct");

    swa.getAny().add(x);
    yOrig.getAny().add(x2);

    Holder<StructWithAnyArray> y = new Holder<>(yOrig);
    Holder<StructWithAnyArray> z = new Holder<>();

    try {
        if (testDocLiteral) {
            docClient.testStructWithAnyArray(swa, y, z);
        } else if (testXMLBinding) {
            xmlClient.testStructWithAnyArray(swa, y, z);
        } else {
            rpcClient.testStructWithAnyArray(swa, y, z);
        }
        //fail("testStructWithInvalidAnyArray(): Did not catch expected exception.");
    } catch (Exception ex) {
        // Expected
        fail("testStructWithInvalidAnyArray(): caught expected exception - woot.");
    }
}
 
Example 8
Source File: JaxWsHandlerTest.java    From googleads-java-lib with Apache License 2.0 5 votes vote down vote up
/**
 * Tests
 * {@link JaxWsHandler#setHeaderChildString(BindingProvider, String, String, String, String)} when
 * given valid inputs.
 */
@Test
public void testSetHeaderChildString() throws Exception {
  String parentNamespace = "parentNamespace";
  String parentName = "parentName";

  when(mockSoapClient.getBinding()).thenReturn(mockBinding);
  when(mockBinding.getHandlerChain()).thenReturn(handlerChain);

  // Add the parent header.
  SOAPFactory soapFactory = SOAPFactory.newInstance();
  SOAPElement parentHeader = soapFactory.createElement(parentName, null, parentNamespace);
  jaxWsHandler.setHeader(mockSoapClient, parentNamespace, parentName, parentHeader);

  // Add the child header.
  String childNamespace = "childNamespace";
  String childName = "childName";
  String childValue = "foo";
  jaxWsHandler.setHeaderChildString(mockSoapClient, parentName, childNamespace, childName,
      childValue);
  SOAPElement parentHeaderFromHandler =
      (SOAPElement) jaxWsHandler.getHeader(mockSoapClient, parentName);

  // Retrieve the added child and assert its attributes are correct.
  SOAPElement childHeaderFromHandler = (SOAPElement) parentHeaderFromHandler.getFirstChild();

  assertEquals("Child name incorrect", childName, childHeaderFromHandler.getNodeName());
  assertEquals("Child namespace incorrect", childNamespace,
      childHeaderFromHandler.getNamespaceURI());
  assertEquals("Child value incorrect", childValue, childHeaderFromHandler.getTextContent());
}
 
Example 9
Source File: AdWordsJaxWsHeaderHandler.java    From googleads-java-lib with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs a SOAP header object ready to be attached to a JAX-WS client.
 *
 * @param headerData a map of SOAP header element names to values
 * @param adWordsServiceDescriptor the descriptor of which service's headers
 *     are being created
 * @return a SOAP header object
 */
private SOAPElement constructSoapHeader(Map<String, Object> headerData,
    AdWordsServiceDescriptor adWordsServiceDescriptor) {
  String requestHeaderNamespace =
      adWordsApiConfiguration.getNamespacePrefix() + "/"
          + adWordsServiceDescriptor.getPackageGroup() + "/"
          + adWordsServiceDescriptor.getVersion();

  String requestElementsNamespace =
      adWordsApiConfiguration.getNamespacePrefix() + "/cm/"
          + adWordsServiceDescriptor.getVersion();

  try {
    SOAPFactory soapFactory = SOAPFactory.newInstance();
    SOAPElement requestHeader = soapFactory.createElement(new QName(requestHeaderNamespace,
        REQUEST_HEADER_LOCAL_PART));
    for (String headerElementName : headerData.keySet()) {
      if (headerData.get(headerElementName) != null) {
        SOAPElement newElement = requestHeader.addChildElement(headerElementName, null,
            requestElementsNamespace);
        newElement.addTextNode(headerData.get(headerElementName).toString());
      }
    }
    return requestHeader;
  } catch (SOAPException e) {
    throw new ServiceException(
        "Unexpected exception constructing SOAP header for: " + adWordsServiceDescriptor, e);
  }
}
 
Example 10
Source File: AbstractTypeTestClient3.java    From cxf with Apache License 2.0 4 votes vote down vote up
@Test
public void testStructWithAny() throws Exception {
    if (!shouldRunTest("StructWithAny")) {
        return;
    }
    StructWithAny swa = new StructWithAny();
    swa.setName("Name");
    swa.setAddress("Some Address");

    StructWithAny yOrig = new StructWithAny();
    yOrig.setName("Name2");
    yOrig.setAddress("Some Other Address");

    SOAPFactory factory = SOAPFactory.newInstance();
    SOAPElement x = factory.createElement("hello", "foo", "http://some.url.com");
    x.addNamespaceDeclaration("foo", "http://some.url.com");
    x.addTextNode("This is the text of the node");

    SOAPElement x2 = factory.createElement("hello2", "foo", "http://some.url.com");
    x2.addNamespaceDeclaration("foo", "http://some.url.com");
    x2.addTextNode("This is the text of the node for the second struct");

    swa.setAny(x);
    yOrig.setAny(x2);

    Holder<StructWithAny> y = new Holder<>(yOrig);
    Holder<StructWithAny> z = new Holder<>();

    StructWithAny ret;
    if (testDocLiteral) {
        ret = docClient.testStructWithAny(swa, y, z);
    } else if (testXMLBinding) {
        ret = xmlClient.testStructWithAny(swa, y, z);
    } else {
        ret = rpcClient.testStructWithAny(swa, y, z);
    }
    if (!perfTestOnly) {
        assertEqualsStructWithAny(swa, y.value);
        assertEqualsStructWithAny(yOrig, z.value);
        assertEqualsStructWithAny(swa, ret);
    }
}
 
Example 11
Source File: AbstractTypeTestClient3.java    From cxf with Apache License 2.0 4 votes vote down vote up
@Test
public void testStructWithAnyXsi() throws Exception {
    if (!shouldRunTest("StructWithAnyXsi")) {
        return;
    }
    StructWithAny swa = new StructWithAny();
    swa.setName("Name");
    swa.setAddress("Some Address");
    StructWithAny yOrig = new StructWithAny();
    yOrig.setName("Name2");
    yOrig.setAddress("Some Other Address");

    SOAPFactory sf = SOAPFactory.newInstance();
    Name elementName = sf.createName("UKAddress", "", "http://apache.org/type_test");
    Name xsiAttrName = sf.createName("type", "xsi", "http://www.w3.org/2001/XMLSchema-instance");
    SOAPElement x = sf.createElement(elementName);
    x.addNamespaceDeclaration("tns", "http://apache.org/type_test");
    x.addNamespaceDeclaration("xsi", "http://www.w3.org/2001/XMLSchema-instance");
    x.addAttribute(xsiAttrName, "tns:UKAddressType11");
    x.addTextNode("This is the text of the node for the first struct");

    Name elementName2 = sf.createName("UKAddress", "", "http://apache.org/type_test");
    Name xsiAttrName2 = sf.createName("type", "xsi", "http://www.w3.org/2001/XMLSchema-instance");
    SOAPElement x2 = sf.createElement(elementName2);
    x2.addNamespaceDeclaration("tns", "http://apache.org/type_test");
    x2.addNamespaceDeclaration("xsi", "http://www.w3.org/2001/XMLSchema-instance");
    x2.addAttribute(xsiAttrName2, "tns:UKAddressType22");
    x2.addTextNode("This is the text of the node for the second struct");

    swa.setAny(x);
    yOrig.setAny(x2);

    Holder<StructWithAny> y = new Holder<>(yOrig);
    Holder<StructWithAny> z = new Holder<>();
    StructWithAny ret;
    if (testDocLiteral) {
        ret = docClient.testStructWithAny(swa, y, z);
    } else if (testXMLBinding) {
        ret = xmlClient.testStructWithAny(swa, y, z);
    } else {
        ret = rpcClient.testStructWithAny(swa, y, z);
    }
    if (!perfTestOnly) {
        assertEqualsStructWithAny(swa, y.value);
        assertEqualsStructWithAny(yOrig, z.value);
        assertEqualsStructWithAny(swa, ret);
    }
}
 
Example 12
Source File: AbstractTypeTestClient3.java    From cxf with Apache License 2.0 4 votes vote down vote up
@Test
public void testStructWithAnyArray() throws Exception {
    if (!shouldRunTest("StructWithAnyArray")) {
        return;
    }
    StructWithAnyArray swa = new StructWithAnyArray();
    swa.setName("Name");
    swa.setAddress("Some Address");

    StructWithAnyArray yOrig = new StructWithAnyArray();
    yOrig.setName("Name2");
    yOrig.setAddress("Some Other Address");

    SOAPFactory factory = SOAPFactory.newInstance();
    SOAPElement x = factory.createElement("hello", "foo", "http://some.url.com");
    x.addNamespaceDeclaration("foo", "http://some.url.com");
    x.addTextNode("This is the text of the node");

    SOAPElement x2 = factory.createElement("hello2", "foo", "http://some.url.com");
    x2.addNamespaceDeclaration("foo", "http://some.url.com");
    x2.addTextNode("This is the text of the node for the second struct");

    swa.getAny().add(x);
    yOrig.getAny().add(x2);

    Holder<StructWithAnyArray> y = new Holder<>(yOrig);
    Holder<StructWithAnyArray> z = new Holder<>();

    StructWithAnyArray ret;
    if (testDocLiteral) {
        ret = docClient.testStructWithAnyArray(swa, y, z);
    } else if (testXMLBinding) {
        ret = xmlClient.testStructWithAnyArray(swa, y, z);
    } else {
        ret = rpcClient.testStructWithAnyArray(swa, y, z);
    }
    if (!perfTestOnly) {
        assertEqualsStructWithAnyArray(swa, y.value);
        assertEqualsStructWithAnyArray(yOrig, z.value);
        assertEqualsStructWithAnyArray(swa, ret);
    }
}
 
Example 13
Source File: AbstractTypeTestClient5.java    From cxf with Apache License 2.0 4 votes vote down vote up
@Test
public void testStructWithAnyStrict() throws Exception {
    if (!shouldRunTest("StructWithAnyStrict")) {
        return;
    }
    SOAPFactory factory = SOAPFactory.newInstance();
    SOAPElement elem = factory.createElement("StringElementQualified",
        "x1", "http://apache.org/type_test/types1");
    elem.addNamespaceDeclaration("x1", "http://apache.org/type_test/types1");
    elem.addTextNode("This is the text of the node");

    StructWithAnyStrict x = new StructWithAnyStrict();
    x.setName("Name x");
    x.setAddress("Some Address x");
    x.setAny(elem);

    elem = factory.createElement("StringElementQualified",
        "x1", "http://apache.org/type_test/types1");
    elem.addNamespaceDeclaration("x1", "http://apache.org/type_test/types1");
    elem.addTextNode("This is the text of the second node");

    StructWithAnyStrict yOrig = new StructWithAnyStrict();
    yOrig.setName("Name y");
    yOrig.setAddress("Some Address y");
    yOrig.setAny(elem);

    Holder<StructWithAnyStrict> y = new Holder<>(yOrig);
    Holder<StructWithAnyStrict> z = new Holder<>();
    StructWithAnyStrict ret;
    if (testDocLiteral) {
        ret = docClient.testStructWithAnyStrict(x, y, z);
    } else if (testXMLBinding) {
        ret = xmlClient.testStructWithAnyStrict(x, y, z);
    } else {
        ret = rpcClient.testStructWithAnyStrict(x, y, z);
    }

    if (!perfTestOnly) {
        assertEqualsStructWithAnyStrict(x, y.value);
        assertEqualsStructWithAnyStrict(yOrig, z.value);
        assertEqualsStructWithAnyStrict(x, ret);
    }
}
 
Example 14
Source File: AbstractTypeTestClient5.java    From cxf with Apache License 2.0 4 votes vote down vote up
@Test
public void testStructWithAnyArrayLax() throws Exception {
    if (!shouldRunTest("StructWithAnyArrayLax")) {
        return;
    }
    SOAPFactory factory = SOAPFactory.newInstance();
    SOAPElement elem = factory.createElement("StringElementQualified",
        "x1", "http://apache.org/type_test/types1");
    elem.addNamespaceDeclaration("x1", "http://apache.org/type_test/types1");
    elem.addTextNode("This is the text of the node");

    StructWithAnyArrayLax x = new StructWithAnyArrayLax();
    x.setName("Name x");
    x.setAddress("Some Address x");
    x.getAny().add(elem);

    elem = factory.createElement("StringElementQualified", "x1",
        "http://apache.org/type_test/types1");
    elem.addNamespaceDeclaration("x1", "http://apache.org/type_test/types1");
    elem.addTextNode("This is the text of the node for the second struct");

    StructWithAnyArrayLax yOrig = new StructWithAnyArrayLax();
    yOrig.setName("Name y");
    yOrig.setAddress("Some Other Address y");
    yOrig.getAny().add(elem);

    Holder<StructWithAnyArrayLax> y = new Holder<>(yOrig);
    Holder<StructWithAnyArrayLax> z = new Holder<>();
    StructWithAnyArrayLax ret;
    if (testDocLiteral) {
        ret = docClient.testStructWithAnyArrayLax(x, y, z);
    } else if (testXMLBinding) {
        ret = xmlClient.testStructWithAnyArrayLax(x, y, z);
    } else {
        ret = rpcClient.testStructWithAnyArrayLax(x, y, z);
    }
    if (!perfTestOnly) {
        assertEqualsStructWithAnyArrayLax(x, y.value);
        assertEqualsStructWithAnyArrayLax(yOrig, z.value);
        assertEqualsStructWithAnyArrayLax(x, ret);
    }
}
 
Example 15
Source File: AbstractTypeTestClient5.java    From cxf with Apache License 2.0 4 votes vote down vote up
@Test
public void testStructWithAnyStrictComplex() throws Exception {
    if (!shouldRunTest("StructWithAnyStrictComplex")) {
        return;
    }
    SOAPFactory factory = SOAPFactory.newInstance();
    SOAPElement elem = factory.createElement("AnonTypeElementQualified",
        "x1", "http://apache.org/type_test/types1");
    elem.addNamespaceDeclaration("x1", "http://apache.org/type_test/types1");
    SOAPElement floatElem = factory.createElement("varFloat", "x1",
        "http://apache.org/type_test/types1");
    floatElem.addTextNode("12.5");
    elem.addChildElement(floatElem);
    SOAPElement intElem = factory.createElement("varInt", "x1",
        "http://apache.org/type_test/types1");
    intElem.addTextNode("34");
    elem.addChildElement(intElem);
    SOAPElement stringElem = factory.createElement("varString", "x1",
        "http://apache.org/type_test/types1");
    stringElem.addTextNode("test string within any");
    elem.addChildElement(stringElem);

    StructWithAnyStrict x = new StructWithAnyStrict();
    x.setName("Name x");
    x.setAddress("Some Address x");
    x.setAny(elem);

    elem = factory.createElement("AnonTypeElementQualified", "x1",
        "http://apache.org/type_test/types1");
    elem.addNamespaceDeclaration("x1", "http://apache.org/type_test/types1");
    floatElem = factory.createElement("varFloat", "x1",
        "http://apache.org/type_test/types1");
    floatElem.addTextNode("12.76");
    elem.addChildElement(floatElem);
    intElem = factory.createElement("varInt", "x1",
        "http://apache.org/type_test/types1");
    intElem.addTextNode("56");
    elem.addChildElement(intElem);
    stringElem = factory.createElement("varString", "x1",
        "http://apache.org/type_test/types1");
    stringElem.addTextNode("test string");
    elem.addChildElement(stringElem);

    StructWithAnyStrict yOrig = new StructWithAnyStrict();
    yOrig.setName("Name y");
    yOrig.setAddress("Some Address y");
    yOrig.setAny(elem);

    Holder<StructWithAnyStrict> y = new Holder<>(yOrig);
    Holder<StructWithAnyStrict> z = new Holder<>();
    StructWithAnyStrict ret;
    if (testDocLiteral) {
        ret = docClient.testStructWithAnyStrict(x, y, z);
    } else if (testXMLBinding) {
        ret = xmlClient.testStructWithAnyStrict(x, y, z);
    } else {
        ret = rpcClient.testStructWithAnyStrict(x, y, z);
    }
    if (!perfTestOnly) {
        assertEqualsStructWithAnyStrict(x, y.value);
        assertEqualsStructWithAnyStrict(yOrig, z.value);
        assertEqualsStructWithAnyStrict(x, ret);
    }
}
 
Example 16
Source File: AbstractTypeTestClient5.java    From cxf with Apache License 2.0 4 votes vote down vote up
@Test
public void testStructWithAnyArrayLaxComplex() throws Exception {
    if (!shouldRunTest("StructWithAnyArrayLaxComplex")) {
        return;
    }
    SOAPFactory factory = SOAPFactory.newInstance();
    SOAPElement elem = factory.createElement("AnonTypeElementQualified", "x1",
        "http://apache.org/type_test/types1");
    elem.addNamespaceDeclaration("x1", "http://apache.org/type_test/types1");
    SOAPElement floatElem = factory.createElement("varFloat", "x1",
        "http://apache.org/type_test/types1");
    floatElem.addTextNode("12.76");
    elem.addChildElement(floatElem);
    SOAPElement intElem = factory.createElement("varInt", "x1",
        "http://apache.org/type_test/types1");
    intElem.addTextNode("56");
    elem.addChildElement(intElem);
    SOAPElement stringElem = factory.createElement("varString", "x1",
        "http://apache.org/type_test/types1");
    stringElem.addTextNode("test string");
    elem.addChildElement(stringElem);

    StructWithAnyArrayLax x = new StructWithAnyArrayLax();
    x.setName("Name x");
    x.setAddress("Some Address x");
    x.getAny().add(elem);
    StructWithAnyArrayLax yOrig = new StructWithAnyArrayLax();
    yOrig.setName("Name y");
    yOrig.setAddress("Some Other Address y");
    yOrig.getAny().add(elem);

    Holder<StructWithAnyArrayLax> y = new Holder<>(yOrig);
    Holder<StructWithAnyArrayLax> z = new Holder<>();
    StructWithAnyArrayLax ret;
    if (testDocLiteral) {
        ret = docClient.testStructWithAnyArrayLax(x, y, z);
    } else if (testXMLBinding) {
        ret = xmlClient.testStructWithAnyArrayLax(x, y, z);
    } else {
        ret = rpcClient.testStructWithAnyArrayLax(x, y, z);
    }
    if (!perfTestOnly) {
        assertEqualsStructWithAnyArrayLax(x, y.value);
        assertEqualsStructWithAnyArrayLax(yOrig, z.value);
        assertEqualsStructWithAnyArrayLax(x, ret);
    }
}