需要从第三方的传入数据中保存XML文档

时间:2017-07-26 20:04:57

标签: vb.net

我需要能够创建一个Web服务,以便当第三方向我发送XML文件时,我可以将文件保存到网站上的文件夹中,以便稍后由文件流阅读器读取并写入本地MySql DB。我的问题是我希望他们能够在不登录的情况下使用凭证等传输XML数据。

我认为我必须将Web服务作为应用程序放在IIS7管理器中,但我不知道要写什么 - 要保存文件。

有一些代码非常接近,但我无法让它工作。

这是我到目前为止的代码 - 是的只是一个骨架。但是在我保存文件之前,这一切都不会发生。我不关心谁发送XML,因为如果第一行不正确,它将被抛出。

Myorders.svc.vb

Imports System Imports System.IO 
Imports System.Xml 
Imports System.Text 
Imports System.Data

Public Class MyOrders

    Implements IMyOrders
    Public Shared OrderNo As String = ""

    Public Function ProcessOrder() Implements IMyOrders.ProcessOrder
        Dim filename As String = "" ' this would need to loop for any doc in the file. Grab JobOrder number as unique'
        Dim xdoc As New XmlDocument

        xdoc.Load(FileName)

        Return OrderNo
    End Function

    Private Sub IMyOrders_GetBuilder(OrderNum As String) Implements IMyOrders.GetBuilder
        Throw New NotImplementedException()
    End Sub

    Public Sub GetSuper(OrderNum As String) Implements IMyOrders.GetSuper
        Throw New NotImplementedException()
    End Sub

    Public Sub GetSuperPhone(OrderNum As String) Implements IMyOrders.GetSuperPhone
        Throw New NotImplementedException()
    End Sub

    Public Sub GetSuperEmail(OrderNum As String) Implements IMyOrders.GetSuperEmail
        Throw New NotImplementedException()
    End Sub

    Public Sub GetWorkType(OrderNum As String) Implements IMyOrders.GetWorkType
        Throw New NotImplementedException()
    End Sub

    Public Sub GetWorkAdd1(OrderNum As String) Implements IMyOrders.GetWorkAdd1
        Throw New NotImplementedException()
    End Sub

    Public Sub GetSubDiv(OrderNum As String) Implements IMyOrders.GetSubDiv
        Throw New NotImplementedException()
    End Sub

    Public Sub GetPhase(OrderNum As String) Implements IMyOrders.GetPhase
        Throw New NotImplementedException()
    End Sub

    Public Sub GetLot(OrderNum As String) Implements IMyOrders.GetLot
        Throw New NotImplementedException()
    End Sub

    Public Sub GetPlan(OrderNum As String) Implements IMyOrders.GetPlan
        Throw New NotImplementedException()
    End Sub

    Public Sub GetElevation(OrderNum As String) Implements IMyOrders.GetElevation
        Throw New NotImplementedException()
    End Sub

    Public Sub GetSwing(OrderNum As String) Implements IMyOrders.GetSwing
        Throw New NotImplementedException()
    End Sub

    Public Sub GetPermit(OrderNum As String) Implements IMyOrders.GetPermit
        Throw New NotImplementedException()
    End Sub

    Public Sub GetStartDate(OrderNum As String) Implements IMyOrders.GetStartDate
        Throw New NotImplementedException()
    End Sub

    Public Sub GetEndDate(OrderNum As String) Implements IMyOrders.GetEndDate
        Throw New NotImplementedException()
    End Sub

    Public Sub GetQuantity(OrderNum As String) Implements IMyOrders.GetQuantity
        Throw New NotImplementedException()
    End Sub

    Public Sub GetMonetary(OrderNum As String) Implements IMyOrders.GetMonetary
        Throw New NotImplementedException()
    End Sub

    Public Sub GetOptions(OrderNum As String) Implements IMyOrders.GetOptions
        Throw New NotImplementedException()
    End Sub

    Public Sub GetCommCode(OrderNum As String) Implements IMyOrders.GetCommCode
        Throw New NotImplementedException()
    End Sub

    Public Sub GetCommID(OrderNum As String) Implements IMyOrders.GetCommID
        Throw New NotImplementedException()
    End Sub

IMyOrders.vb

 Imports System.ServiceModel

' NOTE: You can use the "Rename" command on the context menu to change the interface name "IMyOrders" in both code and config file together.
<ServiceContract()>
Public Interface IMyOrders

    <OperationContract()>
    Function ProcessOrder()

    <OperationContract()>
    Sub GetBuilder(OrderNo As String)

    <OperationContract()>
    Sub GetSuper(OrderNo As String)

    <OperationContract()>
    Sub GetSuperPhone(OrderNo As String)

    <OperationContract()>
    Sub GetSuperEmail(OrderNo As String)

    <OperationContract()>
    Sub GetWorkType(OrderNo As String)

    <OperationContract()>
    Sub GetWorkAdd1(OrderNo As String)

    <OperationContract()>
    Sub GetSubDiv(OrderNo As String)

    <OperationContract()>
    Sub GetPhase(OrderNo As String)

    <OperationContract()>
    Sub GetLot(OrderNo As String)

    <OperationContract()>
    Sub GetPlan(OrderNo As String)

    <OperationContract()>
    Sub GetElevation(OrderNo As String)

    <OperationContract()>
    Sub GetSwing(OrderNo As String)

    <OperationContract()>
    Sub GetPermit(OrderNo As String)

    <OperationContract()>
    Sub GetStartDate(OrderNo As String)

    <OperationContract()>
    Sub GetEndDate(OrderNo As String)

    <OperationContract()>
    Sub GetQuantity(OrderNo As String)

    <OperationContract()>
    Sub GetMonetary(OrderNo As String)

    <OperationContract()>
    Sub GetOptions(OrderNo As String)

    <OperationContract()>
    Sub GetCommCode(OrderNo As String)

    <OperationContract()>
    Sub GetCommID(OrderNo As String)

End Interface

0 个答案:

没有答案