การแก้ปัญหาข้อผิดพลาดในการทำให้นโยบายการตรวจสอบข้อความ SOAP ใช้งานได้

คุณกำลังดูเอกสารประกอบของ Apigee Edge
ไปที่เอกสารประกอบของ Apigee X
ข้อมูล

InvalidResourceType

ข้อความแสดงข้อผิดพลาด

การติดตั้งใช้งานพร็อกซี API ผ่าน Edge UI หรือ Edge Management API ล้มเหลวโดยมีข้อความแสดงข้อผิดพลาดนี้

Error Deploying Revision revision_number to environment
MessageValidation soap_message_validation_policy: Invalid Resource Type resource_type. It should be xsd or wsdl. Context Revision:revision_number;APIProxy:apiproxy_name;Organization:organization;Environment:environment.

ตัวอย่างข้อความแสดงข้อผิดพลาด

Error Deploying Revision 1 to test
MessageValidation SOAP-Message-Validation-1: Invalid Resource Type py.
It should be xsd or wsdl. Context Revision:1;APIProxy:soapmessagevalidation;
Organization:gsc-hipaa;Environment:test.

ภาพหน้าจอตัวอย่างข้อผิดพลาด

สาเหตุ

ข้อผิดพลาดนี้เกิดขึ้นหากมีการตั้งค่าองค์ประกอบ <ResourceURL> ในนโยบาย SOAPMessageValidation เป็นประเภททรัพยากรที่นโยบายไม่รองรับ ประเภททรัพยากรที่รองรับคือ xsd และ wsdl

การวินิจฉัย

  1. ระบุชื่อนโยบาย SOAPMessageValidation และประเภททรัพยากรที่ไม่ถูกต้องที่ใช้ในองค์ประกอบ <ResourceURL> ของนโยบาย คุณจะพบทั้ง 2 รายการนี้ในข้อความแสดงข้อผิดพลาด ตัวอย่างเช่น ในข้อผิดพลาดต่อไปนี้ ชื่อนโยบาย SOAPMessageValidation คือ SOAP-Message-Validation-1 และประเภททรัพยากรคือ py

    Error Deploying Revision 1 to test
    MessageValidation SOAP-Message-Validation-1: Invalid Resource Type py. It should
    be xsd or wsdl. Context Revision:1;APIProxy:soapmessagevalidation;Organization:gsc-
    hipaa;Environment:test.
    
  2. ตรวจสอบ XML ของนโยบาย SOAPMessageValidation ที่ล้มเหลว หากประเภททรัพยากรที่ระบุสำหรับองค์ประกอบ <ResourceURL> ตรงกับประเภททรัพยากรที่ไม่ถูกต้องที่ระบุไว้ในขั้นตอนที่ 1 ด้านบน นั่นเป็นสาเหตุของข้อผิดพลาด

    เช่น นโยบายต่อไปนี้ระบุประเภททรัพยากรเป็น py ซึ่งตรงกับสิ่งที่อยู่ในข้อความแสดงข้อผิดพลาด

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <MessageValidation async="false" continueOnError="false" enabled="true"
        name="SOAP-Message-Validation-1">
        <DisplayName>SOAP Message Validation-1</DisplayName>
        <Properties/>
        <Element namespace="http://sample.com"> sampleObject</Element>
        <SOAPMessage/>
        <Source>request</Source>
        <ResourceURL>py://Script-1.py</ResourceURL>
    </MessageValidation>
    

    เนื่องจากประเภททรัพยากรที่ใช้ใน <ResourceURL> ไม่ใช่ xsd หรือ wsdl การทำให้ใช้งานได้จึงจะล้มเหลวโดยมีข้อผิดพลาดที่แสดงด้านบน

ความละเอียด

ตรวจสอบว่าได้ตั้งค่าประเภททรัพยากรที่ระบุในองค์ประกอบ <ResourceURL> ของนโยบาย SOAPMessageValidation เป็น xsd หรือ wsdl และไฟล์ทรัพยากรใช้การจัดรูปแบบที่ถูกต้อง

หากต้องการแก้ไขตัวอย่างนโยบาย SOAPMessageValidation ที่แสดงด้านบน คุณสามารถแก้ไขประเภททรัพยากรเป็น xsd หรือ wsdl ดังนี้

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<MessageValidation async="false" continueOnError="false" enabled="true"
name="SOAP-Message-Validation-1">
    <DisplayName>SOAP Message Validation-1</DisplayName>
    <Properties/>
    <Element namespace="http://sample.com"> sampleObject</Element>
    <SOAPMessage/>
    <Source>request</Source>
<ResourceURL>wsdl://SOAP-Message-Validation-1.wsdl</ResourceURL>
</MessageValidation>

ResourceCompileFailed

ข้อความแสดงข้อผิดพลาด

การติดตั้งใช้งานพร็อกซี API ผ่าน Edge UI หรือ Edge Management API ล้มเหลวโดยมีข้อความแสดงข้อผิดพลาดนี้

Error Deploying Revision revision_number to environment
MessageValidation soap_message_validation_policy: Failed to compile resource resource. Context Revision:revision_number;APIProxy:apiproxy_name;Organization:organization;Environment:environment.

ตัวอย่างข้อความแสดงข้อผิดพลาด

Error Deploying Revision 1 to test
MessageValidation SOAP-Message-Validation-1: Failed to compile resource SOAP-Message-Validation-1.wsdl. Context Revision:1;APIProxy:soapmessagevalidation;Organization:gsc-hipaa;Environment:test.

ภาพหน้าจอตัวอย่างข้อผิดพลาด

สาเหตุ

ข้อผิดพลาดนี้เกิดขึ้นหากสคริปต์ทรัพยากรที่อ้างอิงในองค์ประกอบ <ResourceURL> ของนโยบาย SOAPMessageValidation มีข้อผิดพลาดที่ทำให้คอมไพล์ไม่ได้ในระหว่างการทำให้ใช้งานได้

การวินิจฉัย

  1. ระบุชื่อนโยบาย SOAPMessageValidation และสคริปต์ทรัพยากรที่ใช้ในนโยบาย คุณจะพบทั้ง 2 รายการนี้ในข้อความแสดงข้อผิดพลาด ตัวอย่างเช่น ในข้อผิดพลาดต่อไปนี้ ชื่อนโยบาย SOAPMessageValidation คือ SOAP-Message-Validation-1 และสคริปต์ทรัพยากรคือ SOAP-Message-Validation-1.wsdl

    Error Deploying Revision 1 to test
    MessageValidation SOAP-Message-Validation-1: Failed to compile resource
    SOAP-Message-Validation-1.wsdl. Context
    Revision:1;APIProxy:soapmessagevalidation;Organization:gsc-hipaa;
    Environment:test.
    
  2. ตรวจสอบ XML ของนโยบาย SOAPMessageValidation ที่ล้มเหลว และยืนยันว่าสคริปต์ทรัพยากรที่ระบุสำหรับองค์ประกอบ <ResourceURL> ตรงกับสิ่งที่อยู่ในข้อความแสดงข้อผิดพลาด

    ตัวอย่างเช่น นโยบายต่อไปนี้ระบุองค์ประกอบ <ResourceURL> เป็น SOAP-Message-Validation-1.wsdl ซึ่งตรงกับสิ่งที่อยู่ในข้อความแสดงข้อผิดพลาด

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <MessageValidation async="false" continueOnError="false" enabled="true"
    name="SOAP-Message-Validation-1">
        <DisplayName>SOAP Message Validation-1</DisplayName>
        <Properties/>
        <Element namespace="http://sample.com"> sampleObject</Element>
        <SOAPMessage/>
        <Source>request</Source>
        <ResourceURL>wsdl://SOAP-Message-Validation-1.wsdl</ResourceURL>
    </MessageValidation>
    
  3. ดูไฟล์สคริปต์ทรัพยากรที่ระบุในขั้นตอนที่ 1 และดูว่ามีปัญหาที่อาจทําให้เกิดข้อผิดพลาดในการรวบรวมหรือไม่

    ตัวอย่างไฟล์สคริปต์ทรัพยากรมีดังนี้

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsd/">
        <wsdl:types>
            <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
                <xs:element name="request" type="xs:string"/>
            </xs:schema>
        </wsdl:types>
    </wsdl:definitions>
    

    เนื่องจาก xmlns:wsdl ชี้ไปที่ URL ที่ไม่ถูกต้อง การทำให้ใช้งานได้จึงจะล้มเหลวโดยมีข้อผิดพลาดที่แสดงด้านบน

ความละเอียด

ตรวจสอบว่าสคริปต์ทรัพยากรที่ระบุในองค์ประกอบ <ResourceURL> ของนโยบาย SOAPMessageValidation ไม่มีปัญหาที่ทำให้คอมไพล์ไม่ได้

หากต้องการแก้ไขสคริปต์ SOAP-Message-Validation-1.wsdl ที่แสดงข้างต้น ให้แก้ไข xmlns:wsdl ให้ชี้ไปยัง URL ที่ถูกต้อง ดังนี้

<?xml version="1.0" encoding="ISO-8859-1"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
    <wsdl:types>
        <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
            <xs:element name="request" type="xs:string"/>
        </xs:schema>
    </wsdl:types>
</wsdl:definitions>

RootElementNameUnspecified

ข้อความแสดงข้อผิดพลาด

การบันทึกพร็อกซี API ผ่าน Edge UI หรือ Edge Management API ล้มเหลวโดยมีข้อความแสดงข้อผิดพลาดนี้

Error Saving Revision revision_number
MessageValidation soap_message_validation_policy:
RootElement name is not specified.

ตัวอย่างข้อความแสดงข้อผิดพลาด

Error Saving Revision 2
MessageValidation SOAP-Message-Validation-1: RootElement name is not specified.

ภาพหน้าจอตัวอย่างข้อผิดพลาด

สาเหตุ

ข้อผิดพลาดนี้เกิดขึ้นหากองค์ประกอบ <Element> ในนโยบาย SOAPMessageValidation ไม่มีชื่อองค์ประกอบรูท

การวินิจฉัย

  1. ระบุชื่อนโยบาย SOAPMessageValidation ที่เกิดข้อผิดพลาด ตัวอย่างเช่น ในข้อผิดพลาดต่อไปนี้ ชื่อนโยบาย SOAPMessageValidation คือ SOAP-Message-Validation-1

    Error Saving Revision 2
    MessageValidation SOAP-Message-Validation-1: RootElement name is not specified.
    
  2. ตรวจสอบ XML ของนโยบาย SOAPMessageValidation ที่ล้มเหลว หากไม่มีการระบุชื่อองค์ประกอบรูทที่ใช้สำหรับการตรวจสอบในองค์ประกอบ <Element> สาเหตุของข้อผิดพลาด

    ตัวอย่างเช่น นโยบายต่อไปนี้ไม่ได้ระบุชื่อองค์ประกอบรูท

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <MessageValidation async="false" continueOnError="false" enabled="true"
    name="SOAP-Message-Validation-1">
        <DisplayName>SOAP Message Validation-1</DisplayName>
        <Properties/>
        <Element namespace="http://schemas.xmlsoap.org/soap/prices"/>
        <SOAPMessage/>
        <Source>request</Source>
        <ResourceURL>xsd://Script-1.xsd</ResourceURL>
    </MessageValidation>
    

    เนื่องจากไม่ได้ระบุชื่อองค์ประกอบรูท การติดตั้งใช้งานจะล้มเหลวโดยมีข้อผิดพลาดที่แสดงด้านบน

ความละเอียด

ตรวจสอบว่าองค์ประกอบ <Element> ของนโยบาย SOAPMessageValidation มีองค์ประกอบรูทที่ถูกต้อง

หากต้องการแก้ไขนโยบาย SOAPMessageValidation ที่แสดงด้านบน ให้แก้ไข <Element> และเพิ่มองค์ประกอบรูทที่ถูกต้องดังต่อไปนี้

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<MessageValidation async="false" continueOnError="false" enabled="true"
name="SOAP-Message-Validation-1">
    <DisplayName>SOAP Message Validation-1</DisplayName>
    <Properties/>
    <Element namespace="http://schemas.xmlsoap.org/soap/prices">GetPriceResponse</Element>
    <SOAPMessage/>
    <Source>request</Source>
    <ResourceURL>xsd://Script-1.xsd</ResourceURL>
</MessageValidation>

InvalidRootElementName

ข้อความแสดงข้อผิดพลาด

การบันทึกพร็อกซี API ผ่าน Edge UI หรือ Edge Management API ล้มเหลวโดยมีข้อความแสดงข้อผิดพลาดนี้

Error Saving Revision revision_number
MessageValidation soap_message_validation_policy: RootElement name root_element_name is invalid.

ตัวอย่างข้อความแสดงข้อผิดพลาด

Error Saving Revision 2
MessageValidation SOAP-Message-Validation-1: RootElement name 1GetPriceResponse
is invalid.

ภาพหน้าจอตัวอย่างข้อผิดพลาด

สาเหตุ

ข้อผิดพลาดนี้เกิดขึ้นหากองค์ประกอบ <Element> ในนโยบาย SOAPMessageValidation มีชื่อองค์ประกอบรูทที่ไม่สอดคล้องกับกฎ XML สำหรับการตั้งชื่อองค์ประกอบที่ถูกต้อง

การวินิจฉัย

  1. ระบุชื่อนโยบาย SOAPMessageValidation ที่เกิดข้อผิดพลาด ตัวอย่างเช่น ในข้อผิดพลาดต่อไปนี้ ชื่อนโยบาย SOAPMessageValidation คือ SOAP-Message-Validation-1

    Error Saving Revision 2
    MessageValidation SOAP-Message-Validation-1: RootElement name 1GetPriceResponse
    is invalid.
    
  2. ตรวจสอบ XML ของนโยบาย SOAPMessageValidation ที่ล้มเหลว หากชื่อองค์ประกอบรูทที่ระบุในองค์ประกอบ <Element> ไม่ตรงกับเกณฑ์สำหรับชื่อองค์ประกอบ XML ที่ถูกต้อง ก็จะทำให้เกิดข้อผิดพลาด

    เช่น นโยบายต่อไปนี้มีชื่อองค์ประกอบรูทที่เริ่มต้นด้วยตัวเลข ซึ่งไม่ถูกต้อง ชื่อองค์ประกอบที่มีเว้นวรรคก็ไม่ถูกต้องเช่นกัน

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <MessageValidation async="false" continueOnError="false" enabled="true"
    name="SOAP-Message-Validation-1">
        <DisplayName>SOAP Message Validation-1</DisplayName>
        <Properties/>
         <Element namespace="http://schemas.xmlsoap.org/soap/prices">1GetPriceResponse</Element>
        <SOAPMessage/>
        <Source>request</Source>
        <ResourceURL>xsd://Script-1.xsd</ResourceURL>
    </MessageValidation>
    

ความละเอียด

ตรวจสอบว่าองค์ประกอบ <Element> ของนโยบาย SOAPMessageValidation มีชื่อองค์ประกอบรูทที่ถูกต้อง

หากต้องการแก้ไขนโยบาย SOAPMessageValidation ที่แสดงด้านบน ให้แก้ไของค์ประกอบ <Element> ให้มีชื่อองค์ประกอบรูทที่ถูกต้องดังที่แสดงด้านล่าง

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<MessageValidation async="false" continueOnError="false" enabled="true" name="SOAP-Message-Validation-1">
    <DisplayName>SOAP Message Validation-1</DisplayName>
    <Properties/>
    <Element namespace="http://schemas.xmlsoap.org/soap/prices">GetPriceResponse</Element>
    <SOAPMessage/>
    <Source>request</Source>
    <ResourceURL>xsd://Script-1.xsd</ResourceURL>
</MessageValidation>

NoElements

ข้อความแสดงข้อผิดพลาด

การทำให้พร็อกซี API ใช้งานได้ผ่าน Edge UI หรือ Edge Management API ล้มเหลวโดยมีข้อความแสดงข้อผิดพลาดนี้

Error Deploying Revision revision_number
Resource "resource_url" has no element definitions.

ตัวอย่างข้อความแสดงข้อผิดพลาด

Error Deploying Revision 2 to test
Resource "xsd://Script-1.xsd" has no element definitions.

ภาพหน้าจอตัวอย่างข้อผิดพลาด

สาเหตุ

ข้อผิดพลาดนี้เกิดขึ้นหากไฟล์ทรัพยากรที่ระบุในองค์ประกอบ <Resource> ของนโยบาย SOAPMessageValidation ไม่มีองค์ประกอบที่ใช้สำหรับการตรวจสอบ

การวินิจฉัย

  1. ระบุไฟล์ทรัพยากรที่ไม่มีคำจำกัดความองค์ประกอบจากข้อความแสดงข้อผิดพลาด ตัวอย่างเช่น ในข้อผิดพลาดต่อไปนี้ ไฟล์ทรัพยากรที่ใช้ในคือ xsd://Script-1.xsd

    Error Deploying Revision 2 to test
    Resource "xsd://Script-1.xsd" has no element definitions.
    
  2. ตรวจสอบไฟล์ทรัพยากรที่ระบุในขั้นตอนที่ 1 หากไม่มีการกำหนดองค์ประกอบใดไว้ ก็แสดงว่านี่เป็นสาเหตุของข้อผิดพลาด

    ตัวอย่างเช่น ไฟล์ทรัพยากร Script-1.xsd ต่อไปนี้ไม่มีองค์ประกอบใดๆ

    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    </xsd:schema>
    

    เนื่องจากไฟล์ทรัพยากรไม่มีองค์ประกอบเลย การทำให้ใช้งานได้จะล้มเหลวโดยมีข้อผิดพลาดที่แสดงด้านบน

ความละเอียด

ตรวจสอบว่าไฟล์ทรัพยากรที่ใช้ในนโยบาย SOAPMessageValidation มีคำจำกัดความองค์ประกอบที่เกี่ยวข้อง

หากต้องการแก้ไขไฟล์ทรัพยากรตัวอย่างที่แสดงข้างต้น คุณสามารถแก้ไขไฟล์ xsd เพื่อเพิ่มเนื้อหาต่อไปนี้

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="shipOrder" type="order"/>
<xsd:complexType name="order">
<xsd:sequence>
<xsd:element name="shipTo" type="shipAddress"/>
<xsd:element name="items" type="cdItems"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="shipAddress">
<xsd:sequence>
<xsd:element name="name" type="xsd:string"/>
<xsd:element name="street" type="xsd:string"/>
<xsd:element name="address" type="xsd:string"/>
<xsd:element name="country" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="cdItems">
<xsd:sequence>
<xsd:element name="item" type="cdItem" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="cdItem">
<xsd:sequence>
<xsd:element name="title" type="xsd:string"/>
<xsd:element name="quantity" type="xsd:integer"/>
<xsd:element name="price" type="xsd:decimal"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>