向Ariba Supplier Network发布MIME编码附件“文件过早结束”

时间:2016-11-08 10:46:33

标签: vb.net web-services mime posting

我的问题是在向Ariba Network发布字符串后的响应。我已经看过类似的问题,但我没有找到答案:

Codesnippet:

{
    ('10.10.10.10', 'RED'): 64540,
    ('192.168.10.10', 'BLUE'): 3802,
}

strRequestFile内容:

' Check only -> no request to send
If chkCheckOnly.Checked = False Then
Dim byteArray As Byte() = Encoding.UTF8.GetBytes(strRequestFile)
Dim request As WebRequest = WebRequest.Create(txtASPServer.Text)
Dim intLength As Integer = byteArray.Length
With request
    .Timeout = Val(strTimeout)
    .Method = "POST"
    .ContentType = "multipart/related;boundary=" & strBoundary     & ";type=""text/xml"";start=""<part1.PC@ganter-interior.com"""
    .Credentials = CredentialCache.DefaultCredentials
    .ContentLength = byteArray.Length
End With

' Create Stream with data
Dim dataStream As System.IO.Stream
dataStream = request.GetRequestStream()
dataStream.Write(byteArray, 0, byteArray.Length)
dataStream.Close()

Dim response As WebResponse = request.GetResponse

' Get the stream containing content returned by the server
dataStream = response.GetResponseStream()
' Open the stream using a StreamReader
Dim reader As New StreamReader(dataStream)
' Read the content.
Dim responseFromServer As String = reader.ReadToEnd()
' Display the content.
Console.WriteLine(responseFromServer)
txtResponse = responseFromServer
txtResponseBox.Text = responseFromServer
' Clean up the streams.
reader.Close()
dataStream.Close()
response.Close()
End If

我们得到的错误响应:

--8d407adf5972fa0
Content-type: text/xml; charset=UTF-8
Content-ID:<part1.PC@ganter-interior.com>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.023/cXML.dtd">
<cXML payloadID="1478164614672-129894812347729669@216.109.111.68"     timestamp="2016-11-08T08:05:19">
<Header>
    <From>
        <Credential domain="NetworkID">
            <Identity>AN01047299320-T</Identity>
        </Credential>
    </From>
    <To>
        <Credential domain="NetworkID">
            <Identity>AN01007225001-T</Identity>
        </Credential>
    </To>
    <Sender>
        <Credential domain="NetworkID">
            <Identity>AN01047299320-T</Identity>
            <SharedSecret>#gan_ariba_2016</SharedSecret>
        </Credential>
        <UserAgent>ganSAP-Ariba</UserAgent>
    </Sender>
</Header>
<Request>
    <CatalogUploadRequest operation="new">
        <CatalogName xml:lang="en">Europe_Burberry_Ganter_SSP</CatalogName>
        <Description xml:lang="en">This can be a very long text for further description of this catalog.</Description>
        <Attachment>
            <URL>cid: Europe_Burberry_Ganter_SSP.cif</URL>
        </Attachment>
        <Commodities>
            <CommodityCode>52</CommodityCode>
        </Commodities>
        <AutoPublish enabled="false" />
        <Notification>
            <Email>schneider@ganter-interior.com</Email>
        </Notification>
    </CatalogUploadRequest>
</Request>
</cXML>
--8d407adf5972fa0
Content-type: text/plain; charset=UTF-8
Content-Disposition: attachment; filename=Europe_Burberry_Ganter_SSP.cif
Content-ID:<Europe_Burberry_Ganter_SSP.cif>
Content-length:  777
CIF_I_V3.0
CHARSET: 
LOADMODE: F
CODEFORMAT: UNSPSC
CURRENCY: EUR
SUPPLIERID_DOMAIN: AN01047299320-T
ITEMCOUNT: 1
TIMESTAMP:2016-11-08
UNUOM: TRUE
COMMENTS:This can be a very long text for further description of this     catalog.
FIELDNAMES: Supplier ID,Supplier Part ID,Manufacturer Part ID,Item Description,SPSC Code,Unit Price,Unit of Measure,Lead Time,Manufacturer Name,Supplier URL,Manufacturer URL,Market Price,Supplier Part Auxiliary ID,Language,Currency,Short Name,Image ,Thumbnail ,Effective Date,Expiration Date,IsPartial
DATA
AN01047299320,HO00GL5C0106,,"Glasses, set of 6",SPSC Code,8.00,SAT,,,,,0.00,,en_GB,EUR,"Glasses, set of 6",HTTP:\\ganter-interior.com\Ariba Images\Catalogs\BURBERRY-EUROPE-SSP\HO00GL5C0106.JPG,,0000-00-00,0000-00-00,FALSE
ENDOFDATA
--8d407adf5972fa0--

我希望,有人可以帮助我吗?

祝你好运 拉尔夫

0 个答案:

没有答案