Quantcast
Channel: WCF, ASMX and other Web Services
Viewing all articles
Browse latest Browse all 555

Need Web Service help for calling a method when XML incoming from external source

$
0
0

First - I must apologize - I have not worked in web development in 8.5 years. I have been working in software development and have never build a web service.

I am running a vb/asp.net 4.5 environment web server.

When setting up the server and to make sure I could get a web service to work, I used the Fahrenheit to Celsius TempConvert and debugged the web config file to make sure everything is working. (http://sierraproductioncenter.com/WebForm1.aspx)

We have an outside vendor who wants to send us XML files to be consumed on our side so I can parse them and feed our DB. My thought on this is I should just need to save the incoming file onto the web server to a file.  I can then loop through the files, validate, and feed data to the SQL DB.

After poking around for 2 days, I found some code that looks like I should be able to save a file to a TempFileName.

<WebMethod()> Public Function GetTempFileName() As String
        Dim g As Guid = New Guid
        Dim fs As FileStream = New FileStream(Server.MapPath(g.ToString()), FileMode.Create)
        fs.Close()

        Return g.ToString()
    End Function

    <WebMethod()> Public Sub AppendToTempFile(ByVal filename As String, ByVal data As Byte)
        Try
            Dim fs As FileStream = New FileStream(Server.MapPath(filename), FileMode.Append)
            Dim bw As BinaryWriter = New BinaryWriter(fs)
            bw.Write(data)
            bw.Close()
            fs.Close()

        Catch ex As Exception
            Throw New Exception("Append to TempFile " + ex.ToString)
        End Try

    End Sub

The issue is - how do I call the method(s) without creating a form action/button on an .aspx?

In theory, shouldn't they be able to send to a web address or does it need to have some kind of form action?


Viewing all articles
Browse latest Browse all 555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>