Hi,
I'm building a web service (first proper one...) that is nice and simple in its requirements but I don't understand some (most) of the fundamentals, so any help is appreciated.
This is what I think I am at - and could be wrong...
I've been given an XSD, and I need to build a web service that will adhere to that XSD.
When our partners call the web service with a token the web service needs to pull about 12 bits of data (name, address etc..) from an orders table and this info needs to be returned to them.
I have got the web service to a point where it calls the database and pulls back the data and returns a dataset. This dataset has all the data I need, it just needs to be manipulated.
Very basic question:
What do I need to do next?
How will I know when my web service is outputing what our partners need?
Thanks
here's the code:
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
'Use data access objects from the SqlClient namespace.
Imports System.Data.SqlClient
<System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ToolboxItem(False)> _
Public Class AffinionWS1
Inherits System.Web.Services.WebService
<WebMethod()> Public Function GetCustOrders(ByVal OrderID As String) As String
'IDMask is the Customer ID that the client submits.
'Modify this connection string to use your SQL Server and log on information.
Dim con As New SqlConnection("Server=xxx;uid=xxx;pwd=xxx;database=xxx")
'3317598
'Open the Receipt table to serve as the parent table.
Dim daCust As New SqlDataAdapter("Select order_id, bill_to_fname + ' ' + bill_to_lname as name, bill_to_street1, bill_to_street2, bill_to_city, bill_to_state, bill_to_zip, email, cc_type, cc_number, cc_expmonth, cc_expyear From receipt Where order_id = '" & OrderID & "'", con)
'Create a client-side DataSet to hold the Customers and Orders tables.
Dim ds As New DataSet()
'Explicitly open the connection to allow explicit closing.
con.Open()
'Fill the DataSet with the Customers table and the Orders table.
daCust.Fill(ds, "receipt")
'Explicitly close the connection - do not wait for garbage collection.
con.Close()
ds.DataSetName = "CustomerDetails"
Return = ds.Tables("receipt").Rows(0).Item(3)
End Function
End Class
As an add on, this is what the example of the respose looks like
<?xml version="1.0" encoding="UTF-8" ?>
<PartnerGateway>
<Partner>
<PartnerID>Partner </PartnerID>
<PartnerPwd>XXX</PartnerPwd>
</Partner>
<CustomerInfoResponse version="1.0" RefCode="ref" Token="123;AAA">
<Status code="OK">Successful</Status>
<CustomerInfo>
<Name first="William" last="Smith"/>
<Email>test@.address.com</Email>
<CreditCard ccType="VISA"
ccNumber="4274000001234039"
ccExpMonth="10"
ccExpYear="2009"/>
<Phone areaCode="614" exchange="652" number="5000">
<Address line1="1 main street" line2="po box 1"
city="dublin"
state="OH"
zip="43017"/>
</CustomerInfo>
</CustomerInfoResponse>
</PartnerGateway>
Did you use WSE3?
0 comments:
Post a Comment