การแก้ปัญหาข้อผิดพลาดในการทำให้นโยบายการตรวจสอบข้อความ 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>