Getting Server Hostname in BPEL

1 message Options
Embed this post
Permalink
petropeter

Getting Server Hostname in BPEL

Reply Threaded More More options
Print post
Permalink
Hi,

I am trying to use JavaScript feature in BPEL for getting the server hostname. Please find below the BPEL code:

<?xml version="1.0" encoding="UTF-8"?>
<process
    name="hostNameProcess"
    targetNamespace="http://enterprise.netbeans.org/bpel/HostNameProcess/hostNameProcess"
    xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:sxt="http://www.sun.com/wsbpel/2.0/process/executable/SUNExtension/Trace"
    xmlns:sxed="http://www.sun.com/wsbpel/2.0/process/executable/SUNExtension/Editor"
    xmlns:sxat="http://www.sun.com/wsbpel/2.0/process/executable/SUNExtension/Attachment"
    xmlns:sxeh="http://www.sun.com/wsbpel/2.0/process/executable/SUNExtension/ErrorHandling"
    xmlns:tns="http://enterprise.netbeans.org/bpel/HostNameProcess/hostNameProcess" xmlns:sxed2="http://www.sun.com/wsbpel/2.0/process/executable/SUNExtension/Editor2">
    <import namespace="http://j2ee.netbeans.org/wsdl/HostNameProcess/HostProcessIn" location="HostProcessIn.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/>
    <partnerLinks>
        <partnerLink name="PartnerLink1" xmlns:tns="http://j2ee.netbeans.org/wsdl/HostNameProcess/HostProcessIn" partnerLinkType="tns:HostProcessIn" myRole="HostProcessInPortTypeRole"/>
    </partnerLinks>
    <variables>
        <variable name="HostProcessInOperationOut" xmlns:tns="http://j2ee.netbeans.org/wsdl/HostNameProcess/HostProcessIn" messageType="tns:HostProcessInOperationResponse"/>
        <variable name="HostProcessInOperationIn" xmlns:tns="http://j2ee.netbeans.org/wsdl/HostNameProcess/HostProcessIn" messageType="tns:HostProcessInOperationRequest"/>
    </variables>
    <sequence>
        <receive name="Receive1" createInstance="yes" partnerLink="PartnerLink1" operation="HostProcessInOperation" xmlns:tns="http://j2ee.netbeans.org/wsdl/HostNameProcess/HostProcessIn" portType="tns:HostProcessInPortType" variable="HostProcessInOperationIn"/>
        <assign name="Assign1">
            <copy>
                <from>'TEMP'</from>
                <to variable="HostProcessInOperationOut" part="part1"/>
            </copy>
        </assign>
        <assign name="JavaScript1">
            <extensionAssignOperation>
                <Expression xmlns="http://www.sun.com/wsbpel/2.0/process/executable/SUNExtension/DataHandling" expressionLanguage="urn:sun:bpel:JavaScript" inputVars="inpVar=HostProcessInOperationOut.part1" outputVars="HostProcessInOperationOut.part1=hostName"><![CDATA[hostName=java.net.InetAddress.getLocalHost().getHostName();


//hostName=window.location.hostname;]]>
</Expression>
            </extensionAssignOperation>
        </assign>
        <reply name="Reply1" partnerLink="PartnerLink1" operation="HostProcessInOperation" xmlns:tns="http://j2ee.netbeans.org/wsdl/HostNameProcess/HostProcessIn" portType="tns:HostProcessInPortType" variable="HostProcessInOperationOut"/>
    </sequence>
</process>

But, in the Soap UI, I am getting the NativeJavaObject instance, instead of hostname, as shown below:

<SOAP-ENV:Body>
      <FileLocation xmlns:msgns="http://j2ee.netbeans.org/wsdl/HostNameProcess/HostProcessIn" xmlns="http://common.schema.com">org.mozilla.javascript.NativeJavaObject@1a71602</FileLocation>
</SOAP-ENV:Body>

Am I missing something here?

Regards,
Petro Peter