Understanding the XSLT Designer

Performing a Test Run of the XSL Transformation Service

Testing an XSL Transformation Service means sending a message that the Service is expecting and receiving, in this case, a reply message.

Before we can perform the testing, we must create a test case.

ProcedureTo create a test case:

  1. In the Projects window, expand the HelloXSLTCAP node and right-click the Test node.

  2. From the pop-up menu, select New Test Case.

  3. In the Test Case Name field, type JohnSmith. Click Next.

  4. Under Select the WSDL Document, expand HelloXSLTransformation - XSLT Process Files and select HelloXSLTWSDL.wsdl. Click Next.

  5. Under Select the Operation to Test, expand HelloXSLTWSDLBinding and select HelloXSLTWSDLOperation. Click Finish.

  6. The JohnSmith node appears under HelloXSLTCAP > Test and the input message file—Input.xml —opens in the editor.

    Input Message
  7. In the Input.xml, modify the


     <hel:name>?string?</hel:name>

    line to


     <hel:name>John Smith</hel:name>

    The Input.xml file should be:


     <soapenv:Envelope xsi:schemaLocation=
    "http://schemas.xmlsoap.org/soap/envelope/ http://schemas.xmlsoap.org/
    soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv=
    "http://schemas.xmlsoap.org/soap/envelope/" 
    xmlns:hel="http://xml.netbeans.org/schema/HelloXSLTIncoming">
    
            <soapenv:Body>
    
                    <hel:name>John Smith</hel:name>
    
            </soapenv:Body>
    
    </soapenv:Envelope> 
    
                    
  8. Click the Save All button on the toolbar.

    The Output node under the test case node refers to the expected reply message that is used for comparison with the actual reply messages. Before we run the test for the first time, the Output.xml file is empty. We will populate it with the content of the reply message (provided that it is what we expect).

ProcedureTo run the test:

  1. Right-click the JohnSmith node and select Run. Notice that the test fails and the following dialog box appears:

    Overwrite Dialog
  2. Click Yes. Notice that the failed test node appears below the Output node.

    Failed Test Node
  3. Double-click the failed test node to see the message that the XSL Transformation Service sent back:


    <?xml version="1.0" encoding="UTF-8"?>
    
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/
    XMLSchema-instance" xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/ 
    http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://xml.netbeans.org/
    schema/HelloXSLTOutgoing">
    
            <SOAP-ENV:Header/>
    
            <SOAP-ENV:Body>
    
                    <ns:greeting xmlns:ns="http://xml.netbeans.org/schema/
    HelloXSLTOutgoing">Hello John Smith</ns:greeting>
    
            </SOAP-ENV:Body>
    
    </SOAP-ENV:Envelope>

    Notice the line


     <ns:greeting xmlns:ns="http://xml.netbeans.org/schema/HelloXSLTOutgoing">Hello John Smith</ns:greeting> 
    
                    

    The XSL Transformation Service received the name, concatenated it with the string 'Hello' and sent the reply message.

  4. Run the test again. The test is marked as passed.

    Test Passed

    You have successfully created, deployed and tested an XSL Transformation Service.

    Now that you have successfully created the Request-Reply XSL Transformation Service, continue with the Service Bridge type.