在生成的BPEL流程ODE的wsdl文件中导入xsd模式

时间:2018-01-16 19:20:44

标签: java xsd wsdl bpel apache-ode

我正在试图实现一个简单的BPEL流程,它应该能够接受外部XSD中定义的元素作为输入。

我正在使用 Eclipse Oxigen.2发行版(4.7.2) Eclipse BPEL设计器1.05最终版,我也在中运行BPEL流程> Apache ODE Server 1.3.7

为了实现这一点,我在BPEL生成的WSDL中导入XSD,但当我包含此标记时,如果我退出 import 标记, apache ODE控制台不会显示该过程该过程在控制台中显示并正确运行。

由于 BPEL2.0 基于 WSDL1.1 ,我跟随WSDL1.1 specification in the Authoring Style part,但在示例中似乎是一个错误,因为它们使用wsdl:import导入XSD。尝试以这种方式导入XSD会在eclipse中引发验证错误。

我发现this answer指向this link,表明WSDL1.1规范中的错误:

  

WSDL 1.1中的一些示例错误地显示了WSDL import语句   用于导入XML模式定义。该简介澄清了使用   进口机制,以保持一致和局限于他们的   各自的域名。导入的模式文档也受到约束   XML版本和编码要求与那些一致   导入WSDL文档。

     

R2001描述必须仅使用WSDL" import"声明   导入另一个WSDL描述。

     

R2803在DESCRIPTION中,wsdl:import的namespace属性   绝不能是相对URI。

     

R2002要导入XML模式定义,描述必须使用XML   Schema" import"言。

     

R2003描述必须使用XML Schema" import"只有声明   在类型部分的xsd:schema元素中。

     

R2004在描述中xsd:import的schemaLocation属性   元素绝不能解析为根元素不是的任何文档   "模式"来自命名空间" http://www.w3.org/2001/XMLSchema"。

     

R2009由DESCRIPTION直接或间接导入的XML Schema   可能包括Unicode字节顺序标记(BOM)。

     

R2010由DESCRIPTION直接或间接导入的XML Schema   必须使用UTF-8或UTF-16编码。

     

R2011由DESCRIPTION直接或间接导入的XML Schema   必须使用可扩展标记语言W3C的1.0版本   建议。

因此,根据上述信息,我现在拥有:

1。 XSD Sxhema

<?xml version="1.0" encoding="UTF-8"?>

<xsd:schema xmlns="urn:oasis:names:specification:ubl:schema:xsd:OrderCancellation-2"
            xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
            xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
            xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:ccts="urn:un:unece:uncefact:documentation:2"
            targetNamespace="urn:oasis:names:specification:ubl:schema:xsd:OrderCancellation-2"
            elementFormDefault="qualified"
            attributeFormDefault="unqualified"
            version="2.1">

   <!-- ===== Imports ===== -->
   <xsd:import namespace="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
               schemaLocation="../common/UBL-CommonAggregateComponents-2.1.xsd"/>
   <xsd:import namespace="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
               schemaLocation="../common/UBL-CommonBasicComponents-2.1.xsd"/>
   <xsd:import namespace="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2"
               schemaLocation="../common/UBL-CommonExtensionComponents-2.1.xsd"/>

   <!-- ===== Element Declarations ===== -->
   <xsd:element name="OrderCancellation" type="OrderCancellationType">
      <xsd:annotation>
         <xsd:documentation>This element MUST be conveyed as the root element in any instance document based on this Schema expression</xsd:documentation>
      </xsd:annotation>
   </xsd:element>

   <!-- ===== Type Definitions ===== -->

   <xsd:complexType name="OrderCancellationType">
      <xsd:annotation>
         <xsd:documentation>
            <ccts:Component>
               <ccts:ComponentType>ABIE</ccts:ComponentType>
               <ccts:DictionaryEntryName>Order Cancellation. Details</ccts:DictionaryEntryName>
               <ccts:Definition>A document used to cancel an entire Order.</ccts:Definition>
               <ccts:ObjectClass>Order Cancellation</ccts:ObjectClass>
            </ccts:Component>
         </xsd:documentation>
      </xsd:annotation>
      <xsd:sequence>
         <xsd:element ref="cbc:IssueDate" minOccurs="1" maxOccurs="1">
            <xsd:annotation>
               <xsd:documentation>
                  <ccts:Component>
                     <ccts:ComponentType>BBIE</ccts:ComponentType>
                     <ccts:DictionaryEntryName>Order Cancellation. Issue Date. Date</ccts:DictionaryEntryName>
                     <ccts:Definition>The date, assigned by the sender, on which this document was issued.</ccts:Definition>
                     <ccts:Cardinality>1</ccts:Cardinality>
                     <ccts:ObjectClass>Order Cancellation</ccts:ObjectClass>
                     <ccts:PropertyTerm>Issue Date</ccts:PropertyTerm>
                     <ccts:RepresentationTerm>Date</ccts:RepresentationTerm>
                     <ccts:DataType>Date. Type</ccts:DataType>
                  </ccts:Component>
               </xsd:documentation>
            </xsd:annotation>
         </xsd:element>
         <xsd:element ref="cbc:IssueTime" minOccurs="0" maxOccurs="1">
            <xsd:annotation>
                ...
            </xsd:annotation>
         </xsd:element>
         <xsd:element ref="cbc:Note" minOccurs="0" maxOccurs="unbounded">
            <xsd:annotation>
                ...
            </xsd:annotation>
         </xsd:element>
      </xsd:sequence>
   </xsd:complexType>
</xsd:schema>

2。生成BPEL流程的WSDL

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<definitions 
    xmlns="http://schemas.xmlsoap.org/wsdl/" 
    xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype" 
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
    xmlns:tns="http://br.ufsc.das.ubl"
    xmlns:ubl="urn:oasis:names:specification:ubl:schema:xsd:OrderCancellation-2" 
    xmlns:vprop="http://docs.oasis-open.org/wsbpel/2.0/varprop" 
    xmlns:wsdl="http://service.endpoint.br.ufsc.das/"
    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    name="OrderingUBL" 
    targetNamespace="http://br.ufsc.das.ubl">

<!--
  Added XSD namespace 

xmlns:ubl="urn:oasis:names:specification:ubl:schema:xsd:OrderCancellation-2" 
-->

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     TYPE DEFINITION - List of types participating in this BPEL process 
     The BPEL Designer will generate default request and response types
     but you can define or import any XML Schema type and use them as part 
     of the message types.
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->    
    <plnk:partnerLinkType name="IntegratorEndPoint_PLT">
        <plnk:role name="IntegratorEndPoint_Role" portType="wsdl:IntegrationEndPointImpl"/>
    </plnk:partnerLinkType>

    <import location="file:/C:/my/path/IntegrationEndpoint.wsdl" namespace="http://service.endpoint.br.ufsc.das/"/>

    <types>
        <schema xmlns="http://www.w3.org/2001/XMLSchema" 
                attributeFormDefault="unqualified" 
                elementFormDefault="qualified" 
                targetNamespace="http://br.ufsc.das.ubl">

            <!--Importing the XSD file-->
            <import 
                namespace="urn:oasis:names:specification:ubl:schema:xsd:OrderCancellation-2" 
                schemaLocation="file:/C:/UBL-2.1/xsd/maindoc/UBL-OrderCancellation-2.xsd" />

            <element name="OrderingUBLRequest">
                <complexType>
                    <sequence>
                        <!-- Defining the Type of element OrderingUBLRequest 
                             to be the element in the imported XSD 
                        -->
                        <element name="input" type="ubl:OrderCancellationType" /> 
                    </sequence>
                </complexType>
            </element>

            <element name="OrderingUBLResponse">
                <complexType>
                    <sequence>
                        <element name="result" type="string"/>
                    </sequence>
                </complexType>
            </element>
        </schema>        
    </types>


<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     MESSAGE TYPE DEFINITION - Definition of the message types used as 
     part of the port type defintions
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->    
    <message name="OrderingUBLRequestMessage">
        <part element="tns:OrderingUBLRequest" name="payload"/>
    </message>

    <message name="OrderingUBLResponseMessage">
        <part element="tns:OrderingUBLResponse" name="payload"/>
    </message>

    <!--
        .
        . All the other WSDL tags
        .
    -->
</definitions>

问题

我是否遗漏了在WSDL BPEL文件中导入XSD并在Apache ODE中运行它的内容?

0 个答案:

没有答案