[Users] XSLT help

vlinhp2 petals-components at ebmwebsourcing.com
Wed Mar 16 10:32:14 CET 2011


Hi,

I have deployed a XSLT example on PEtALS:
    - I send my name "vlinhp2" to HelloXSLTWSDL.wsdl
    - HelloXSLTWSDL.wsdl send my name to the HelloXSLTService.xsl.
    - The XSLT service concate "Hello: " + "vlinhp2" and return the concatened string.
I put sa-XSLT-HelloXSLTWSDLService-provide.zip in PEtALS install folder. You can download my eclipse source code:http://www.mediafire.com/download.php?hfzgyyyyygv
The HelloXSLTWSDL.wsdl

Code:
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="HelloXSLTWSDL" targetNamespace="http://j2ee.netbeans.org/wsdl/HelloXSLTWSDL" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype" xmlns:ns="http://xml.netbeans.org/schema/HelloXSLTIncoming" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://j2ee.netbeans.org/wsdl/HelloXSLTWSDL" xmlns:ns0="http://xml.netbeans.org/schema/HelloXSLTOutgoing" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
  <types>
    <xsd:schema targetNamespace="http://j2ee.netbeans.org/wsdl/HelloXSLTWSDL">
      <xsd:import namespace="http://xml.netbeans.org/schema/HelloXSLTOutgoing" schemaLocation="HelloXSLTOutgoing.xsd"/>
      <xsd:import namespace="http://xml.netbeans.org/schema/HelloXSLTIncoming" schemaLocation="HelloXSLTIncoming.xsd"/>
    </xsd:schema>
  </types>
  <message name="HelloXSLTWSDLOperationRequest">
    <part name="part1" element="ns:name">
    </part>
  </message>
  <message name="HelloXSLTWSDLOperationResponse">
    <part name="part1" element="ns0:greeting">
    </part>
  </message>
  <portType name="HelloXSLTWSDLPortType">
    <operation name="HelloXSLTWSDLOperation">
      <input name="input1" message="tns:HelloXSLTWSDLOperationRequest">
    </input>
      <output name="output1" message="tns:HelloXSLTWSDLOperationResponse">
    </output>
    </operation>
  </portType>
  <binding name="HelloXSLTWSDLBinding" type="tns:HelloXSLTWSDLPortType">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="HelloXSLTWSDLOperation">
      <soap:operation/>
      <input name="input1">
        <soap:body use="literal"/>
      </input>
      <output name="output1">
        <soap:body use="literal"/>
      </output>
    </operation>
  </binding>
  <service name="HelloXSLTWSDLService">
    <port name="HelloXSLTWSDLPort" binding="tns:HelloXSLTWSDLBinding">
      <soap:address location="http://localhost:${HttpDefaultPort}/HelloXSLTWSDLService/HelloXSLTWSDLPort"/>
    </port>
  </service>
    <plnk:partnerLinkType name="HelloXSLTWSDL">
    <!-- A partner link type is automatically generated when a new port type is added. Partner link types are used by BPEL processes. 
In a BPEL process, a partner link represents the interaction between the BPEL process and a partner service. Each partner link is associated with a partner link type.
A partner link type characterizes the conversational relationship between two services. The partner link type can have one or two roles.-->
    <plnk:role name="HelloXSLTWSDLPortTypeRole" portType="tns:HelloXSLTWSDLPortType"/>
  </plnk:partnerLinkType>
</definitions>



HelloXSLTIncoming.xsd for WSDL file:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://xml.netbeans.org/schema/HelloXSLTIncoming" targetNamespace="http://xml.netbeans.org/schema/HelloXSLTIncoming" elementFormDefault="qualified">
  <xsd:element name="name" type="xsd:string" />
</xsd:schema>



The HelloXSLTOutgoing.xsd for WSDL file:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://xml.netbeans.org/schema/HelloXSLTOutgoing" targetNamespace="http://xml.netbeans.org/schema/HelloXSLTOutgoing" elementFormDefault="qualified">
  <xsd:element name="greeting" type="xsd:string" />
</xsd:schema>



The HelloXSLTService.xsl

Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:ns1="http://xml.netbeans.org/schema/HelloXSLTIncoming" xmlns:ns="http://xml.netbeans.org/schema/HelloXSLTOutgoing">
    <xsl:template match="/">
        <xsl:element name="ns:greeting">
            <xsl:value-of select="concat(&apos;Hello: &apos;, /ns1:name)"/>
        </xsl:element>
    </xsl:template>
</xsl:stylesheet>


The jbi.xml

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!-- 
	JBI descriptor for the PEtALS' "petals-se-xslt" component (XSLT).
	Originally created for the version 2.2 of the component.
 -->
<jbi:jbi version="1.0" 
	xmlns:generatedNs="http://j2ee.netbeans.org/wsdl/HelloXSLTWSDL"
	xmlns:jbi="http://java.sun.com/xml/ns/jbi"
	xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-4.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:xslt="http://petals.ow2.org/components/xslt/version-2.2">
	
	<!-- Import a Service into PEtALS or Expose a PEtALS Service => use a BC. -->
	<jbi:services binding-component="false">
	
		<!-- Import a Service into PEtALS => provides a Service. -->
		<jbi:provides 		
			interface-name="generatedNs:HelloXSLTWSDLPortType"
			service-name="generatedNs:HelloXSLTWSDLService"
			endpoint-name="HelloXSLTWSDLPort">
	
			<!-- CDK specific elements -->
			<petalsCDK:wsdl>HelloXSLTWSDL.wsdl</petalsCDK:wsdl>
		
			<!-- Component specific elements -->	
			<xslt:stylesheet>HelloXSLTService.xsl</xslt:stylesheet>			
		</jbi:provides>
	</jbi:services>
</jbi:jbi>


I used petals-sample-client to test this example, the input message like that:

Code:

<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>vlinhp2</hel:name>
  </soapenv:Body>
</soapenv:Envelope>


It works, but the response not cantains my name:

Code:
<?xml version="1.0" encoding="UTF-8"?><ns:greeting xmlns:ns="http://xml.netbeans.org/schema/HelloXSLTOutgoing">Hello: </ns:greeting>



Do you know this problem ? can you help me ? I think that may be my WSDL or my XSLT service not working.
Thanks !




-------------------- m2f --------------------

Read this forum topic online here:
http://petals.ebmwebsourcing.com/forum/viewtopic.php?p=766#766

-------------------- m2f --------------------


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://forum-list.petalslink.org/pipermail/users/attachments/20110316/6d00b9bd/attachment.htm>


More information about the Users mailing list