0

我正在尝试将 XML 提要作为字符串发送到托管在 SSL 服务器上的 REST 服务。在过去的几个月里,我一直在为一个客户断断续续地拉扯我的头发,他们说它在他们的系统和外部都可以工作,所以就他们而言,它必须是我们的服务器或我们的脚本。

这是 PHP 脚本。

<?php

    $endURI     = 'https://****.****.com/Service.svc/CreateProject';

    function curlRequest($uri, $data = false)
    {
        $ch = curl_init();

        //curl_setopt($ch, CURLOPT_HEADER, true); 
        curl_setopt($ch, CURLINFO_HEADER_OUT, true);
        curl_setopt($ch, CURLOPT_VERBOSE, true);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

        curl_setopt($ch, CURLOPT_URL, $uri);

        if($data)
        {
            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $data);   
        }

        $response = curl_exec($ch);

        if($response)
        {
            echo $response;
        }
        else
        {
            echo 'Error Code (' . curl_errno($ch) . '): ' . curl_error($ch);
            echo '<pre>';
            var_dump(curl_getinfo($ch));
            echo '</pre>';
        }

        curl_close($ch);
    }

    if($_POST['data'])
    {
        curlRequest($endURI, simplexml_load_string($_POST['data']));
    }

?>

返回的错误不是很有帮助,但我相信由于错误的上下文,这是最终的结果。

The server encountered an error processing the request. See server logs for more details.

我也会列出 XML 文件,以防它有任何帮助,但我对此表示怀疑。这只是测试数据,所以根本不敏感。

<?xml version="1.0" encoding="utf-8"?>
<CreateProjectRequest>
  <RequestHeader>
    <VendorKey>****</VendorKey>
    <Password>****</Password>
    <CorrelationID>****</CorrelationID>
    <QoS>QoS1</QoS>
  </RequestHeader>
  <RequestBody>
    <Project ClientID="ClientID1" SourceID="SourceID1">
      <ProjectName>ProjectName1</ProjectName>
      <BusinessUnit>HPE (BE)</BusinessUnit>
      <LegalEntity>LegalEntity1</LegalEntity>
      <ProjectStart>1900-01-01</ProjectStart>
      <ProjectEnd>1900-01-01</ProjectEnd>
      <ProjectStatus>Active</ProjectStatus>
      <ExpectedPaymentDatePeriod>Jan-Mar</ExpectedPaymentDatePeriod>
      <ExpectedPaymentDateYear>2012</ExpectedPaymentDateYear>
      <PaymentCurrency>EUR - Euro Member Countries</PaymentCurrency>
      <SupportingSupplements>Yes</SupportingSupplements>
      <Revisions>Yes</Revisions>
      <ForeignLanguageTranslations>Yes</ForeignLanguageTranslations>
      <NumberOfEditions>This and Subsequent Editions</NumberOfEditions>
      <PromotionalUse>Right to Display in context Project/Title - All Media</PromotionalUse>
      <Derivatives>Yes</Derivatives>
      <DerivativeSubcategory>Abridgements</DerivativeSubcategory>
      <DerivativeSubcategory>Adaptations</DerivativeSubcategory>
      <DerivativeSubcategory>Brief Editions</DerivativeSubcategory>
      <AllMedia>Yes</AllMedia>
      <Print>Yes</Print>
      <Digital>Yes</Digital>
      <WorldRights>Yes</WorldRights>
      <WorldRightsExcludingNAmerica>Yes</WorldRightsExcludingNAmerica>
      <NonWorldRights>Yes</NonWorldRights>
      <TerritoriesOthers>TerritoriesOthers1</TerritoriesOthers>
      <LanguageAll>Yes</LanguageAll>
      <LanguageOthers>LanguageOthers1</LanguageOthers>
      <TitleList>
        <Title ClientID="ClientID1" SourceID="SourceID1">
          <Title>Title1</Title>
          <SeriesTitle>SeriesTitle1</SeriesTitle>
          <Authors>Authors1</Authors>
          <PubDate>1900-01-01</PubDate>
          <EditionNo>EditionNo1</EditionNo>
          <ContentType>Audio</ContentType>
          <IdentifierType>ISBN 13</IdentifierType>
          <Identifier>Identifier1</Identifier>
        </Title>
        <Title ClientID="ClientID2" SourceID="SourceID2">
          <Title>Title2</Title>
          <SeriesTitle>SeriesTitle2</SeriesTitle>
          <Authors>Authors2</Authors>
          <PubDate>0001-01-01</PubDate>
          <EditionNo>EditionNo2</EditionNo>
          <ContentType>Book</ContentType>
          <IdentifierType>Product Code</IdentifierType>
          <Identifier>Identifier2</Identifier>
        </Title>
        <Title ClientID="ClientID3" SourceID="SourceID3">
          <Title>Title3</Title>
          <SeriesTitle>SeriesTitle3</SeriesTitle>
          <Authors>Authors3</Authors>
          <PubDate>9999-12-31</PubDate>
          <EditionNo>EditionNo3</EditionNo>
          <ContentType>CD-ROM</ContentType>
          <IdentifierType>ISBN 13</IdentifierType>
          <Identifier>Identifier3</Identifier>
        </Title>
      </TitleList>
      <AssetList>
        <Asset ClientID="ClientID1" SourceID="SourceID1">
          <ContentClass>Audio</ContentClass>
          <ContentType>Activity</ContentType>
          <CaptionDesc>CaptionDesc1</CaptionDesc>
          <SourceName>SourceName1</SourceName>
          <SourceAssetID>SourceAssetID1</SourceAssetID>
          <CreditLine>CreditLine1</CreditLine>
          <PearsonReferenceNo>PearsonReferenceNo1</PearsonReferenceNo>
          <PermissionEditor>PermissionEditor1</PermissionEditor>
          <CopyrightName>CopyrightName1</CopyrightName>
          <Placement>All</Placement>
          <CurrencyCode>EUR - Euro Member Countries</CurrencyCode>
          <Pricing>Pricing1</Pricing>
          <PreviouslyClearedbyPearson>Yes</PreviouslyClearedbyPearson>
          <PearsonProductIdentifier>PearsonProductIdentifier1</PearsonProductIdentifier>
          <SubscriptionDeal>Yes</SubscriptionDeal>
          <Ownership>Ownership1</Ownership>
          <RightsClass>Pearson Wholly Owned</RightsClass>
          <ReuseStatus>Re-use prohibited</ReuseStatus>
          <LicenseExpDate>1900-01-01</LicenseExpDate>
          <LocationRelease>Obtained</LocationRelease>
          <PerformanceRelease>Obtained</PerformanceRelease>
          <ModelRelease>Obtained</ModelRelease>
          <RightsAsRequested>Yes</RightsAsRequested>
          <FormatAsRequested>Yes</FormatAsRequested>
          <TerritoriesAsRequested>Yes</TerritoriesAsRequested>
          <LanguageAsRequested>Yes</LanguageAsRequested>
          <SupportingSupplements>Yes</SupportingSupplements>
          <Revisions>Yes</Revisions>
          <ForeignLanguageTranslations>Yes</ForeignLanguageTranslations>
          <NumberOfEditions>This and Subsequent Editions</NumberOfEditions>
          <PromotionalUse>Right to Display in context Project/Title - All Media</PromotionalUse>
          <Derivatives>Yes</Derivatives>
          <DerivativeSubcategory>Abridgements</DerivativeSubcategory>
          <DerivativeSubcategory>Adaptations</DerivativeSubcategory>
          <DerivativeSubcategory>Brief Editions</DerivativeSubcategory>
          <AllMedia>Yes</AllMedia>
          <AllMediaQuantity>AllMediaQuantity1</AllMediaQuantity>
          <Print>Yes</Print>
          <PrintQuantity>PrintQuantity1</PrintQuantity>
          <Digital>Yes</Digital>
          <DigitalQuantity>DigitalQuantity1</DigitalQuantity>
          <WorldRights>Yes</WorldRights>
          <WorldRightsExcludingNAmerica>Yes</WorldRightsExcludingNAmerica>
          <NonWorldRights>Yes</NonWorldRights>
          <OtherTerritories>OtherTerritories1</OtherTerritories>
          <AllLanguages>Yes</AllLanguages>
          <OtherLanguages>OtherLanguages1</OtherLanguages>
          <RightsRestrictions>RightsRestrictions1</RightsRestrictions>
          <GeneralComments>GeneralComments1</GeneralComments>
          <PermissionCleared>Yes</PermissionCleared>
          <TitleReferences>
            <TitleRef ClientID="ClientID1" />
            <TitleRef ClientID="ClientID2" />
            <TitleRef ClientID="ClientID3" />
          </TitleReferences>
        </Asset>
        <Asset ClientID="ClientID2" SourceID="SourceID2">
          <ContentClass>Image</ContentClass>
          <ContentType>Advertisement</ContentType>
          <CaptionDesc>CaptionDesc2</CaptionDesc>
          <SourceName>SourceName2</SourceName>
          <SourceAssetID>SourceAssetID2</SourceAssetID>
          <CreditLine>CreditLine2</CreditLine>
          <PearsonReferenceNo>PearsonReferenceNo2</PearsonReferenceNo>
          <PermissionEditor>PermissionEditor2</PermissionEditor>
          <CopyrightName>CopyrightName2</CopyrightName>
          <Placement>Cover</Placement>
          <CurrencyCode>HKD - Hong Kong Dollar</CurrencyCode>
          <Pricing>Pricing2</Pricing>
          <PreviouslyClearedbyPearson>No</PreviouslyClearedbyPearson>
          <PearsonProductIdentifier>PearsonProductIdentifier2</PearsonProductIdentifier>
          <SubscriptionDeal>No</SubscriptionDeal>
          <Ownership>Ownership2</Ownership>
          <RightsClass>Rights Manged</RightsClass>
          <ReuseStatus>Re-use permitted with clearance</ReuseStatus>
          <LicenseExpDate>0001-01-01</LicenseExpDate>
          <LocationRelease>Not Obtained</LocationRelease>
          <PerformanceRelease>Not Obtained</PerformanceRelease>
          <ModelRelease>Not Obtained</ModelRelease>
          <RightsAsRequested>No</RightsAsRequested>
          <FormatAsRequested>No</FormatAsRequested>
          <TerritoriesAsRequested>No</TerritoriesAsRequested>
          <LanguageAsRequested>No</LanguageAsRequested>
          <SupportingSupplements>No</SupportingSupplements>
          <Revisions>No</Revisions>
          <ForeignLanguageTranslations>No</ForeignLanguageTranslations>
          <NumberOfEditions>This Edition only</NumberOfEditions>
          <PromotionalUse>Right to Display in context Project/Title - Digitial</PromotionalUse>
          <Derivatives>No</Derivatives>
          <DerivativeSubcategory>Custom Versions</DerivativeSubcategory>
          <DerivativeSubcategory>Split Editions</DerivativeSubcategory>
          <DerivativeSubcategory>Versions</DerivativeSubcategory>
          <AllMedia>No</AllMedia>
          <AllMediaQuantity>AllMediaQuantity2</AllMediaQuantity>
          <Print>No</Print>
          <PrintQuantity>PrintQuantity2</PrintQuantity>
          <Digital>No</Digital>
          <DigitalQuantity>DigitalQuantity2</DigitalQuantity>
          <WorldRights>No</WorldRights>
          <WorldRightsExcludingNAmerica>No</WorldRightsExcludingNAmerica>
          <NonWorldRights>No</NonWorldRights>
          <OtherTerritories>OtherTerritories2</OtherTerritories>
          <AllLanguages>No</AllLanguages>
          <OtherLanguages>OtherLanguages2</OtherLanguages>
          <RightsRestrictions>RightsRestrictions2</RightsRestrictions>
          <GeneralComments>GeneralComments2</GeneralComments>
          <PermissionCleared>No</PermissionCleared>
          <TitleReferences>
            <TitleRef ClientID="ClientID4" />
            <TitleRef ClientID="ClientID5" />
            <TitleRef ClientID="ClientID6" />
          </TitleReferences>
        </Asset>
        <Asset ClientID="ClientID3" SourceID="SourceID3">
          <ContentClass>Text</ContentClass>
          <ContentType>Appendices</ContentType>
          <CaptionDesc>CaptionDesc3</CaptionDesc>
          <SourceName>SourceName3</SourceName>
          <SourceAssetID>SourceAssetID3</SourceAssetID>
          <CreditLine>CreditLine3</CreditLine>
          <PearsonReferenceNo>PearsonReferenceNo3</PearsonReferenceNo>
          <PermissionEditor>PermissionEditor3</PermissionEditor>
          <CopyrightName>CopyrightName3</CopyrightName>
          <Placement>Electronic</Placement>
          <CurrencyCode>ZAR - South African rand</CurrencyCode>
          <Pricing>Pricing3</Pricing>
          <PreviouslyClearedbyPearson>Yes</PreviouslyClearedbyPearson>
          <PearsonProductIdentifier>PearsonProductIdentifier3</PearsonProductIdentifier>
          <SubscriptionDeal>Yes</SubscriptionDeal>
          <Ownership>Ownership3</Ownership>
          <RightsClass>Royalty Free</RightsClass>
          <ReuseStatus>Re-use prohibited</ReuseStatus>
          <LicenseExpDate>9999-12-31</LicenseExpDate>
          <LocationRelease>Not Applicable</LocationRelease>
          <PerformanceRelease>Not Applicable</PerformanceRelease>
          <ModelRelease>Not Applicable</ModelRelease>
          <RightsAsRequested>Yes</RightsAsRequested>
          <FormatAsRequested>Yes</FormatAsRequested>
          <TerritoriesAsRequested>Yes</TerritoriesAsRequested>
          <LanguageAsRequested>Yes</LanguageAsRequested>
          <SupportingSupplements>Yes</SupportingSupplements>
          <Revisions>Yes</Revisions>
          <ForeignLanguageTranslations>Yes</ForeignLanguageTranslations>
          <NumberOfEditions>This and Subsequent Editions</NumberOfEditions>
          <PromotionalUse>Right to Display in context Project/Title - Print</PromotionalUse>
          <Derivatives>Yes</Derivatives>
          <DerivativeSubcategory>Abridgements</DerivativeSubcategory>
          <DerivativeSubcategory>Adaptations</DerivativeSubcategory>
          <DerivativeSubcategory>Brief Editions</DerivativeSubcategory>
          <AllMedia>Yes</AllMedia>
          <AllMediaQuantity>AllMediaQuantity3</AllMediaQuantity>
          <Print>Yes</Print>
          <PrintQuantity>PrintQuantity3</PrintQuantity>
          <Digital>Yes</Digital>
          <DigitalQuantity>DigitalQuantity3</DigitalQuantity>
          <WorldRights>Yes</WorldRights>
          <WorldRightsExcludingNAmerica>Yes</WorldRightsExcludingNAmerica>
          <NonWorldRights>Yes</NonWorldRights>
          <OtherTerritories>OtherTerritories3</OtherTerritories>
          <AllLanguages>Yes</AllLanguages>
          <OtherLanguages>OtherLanguages3</OtherLanguages>
          <RightsRestrictions>RightsRestrictions3</RightsRestrictions>
          <GeneralComments>GeneralComments3</GeneralComments>
          <PermissionCleared>Yes</PermissionCleared>
          <TitleReferences>
            <TitleRef ClientID="ClientID7" />
            <TitleRef ClientID="ClientID8" />
            <TitleRef ClientID="ClientID9" />
          </TitleReferences>
        </Asset>
      </AssetList>
    </Project>
  </RequestBody>
</CreateProjectRequest>

如果有人能解决这个问题,我将不胜感激!

4

1 回答 1

0

这绝对是他们最终产生的错误。如果它是 curl 错误,根据您的代码,该错误将在前面加上: echo 'Error Code (' . curl_errno($ch) . '): ' 。curl_error($ch);

但是,您可能会发送错误的请求?我会为这个短语设置一个捕获,并将原始传出和传入 xml 记录到日志文件/数据库中,以引起他们的注意。

于 2013-07-29T21:14:22.073 回答