Hi!
I hope someone can help! At work, I manage a SQL server. We also have an Oracle box. I have data in a SQL database that needs to be updated to a database in Oracle. Basically, I need to insert 250 records (four fields each) from a table in the SQL table into an already existing table in Oracle. The head of our IT department has provided me with a web service, but I really have no clue how to use it. I'm fairly new to VB.Net, and consuming a Web Service is a new programming task for me.
I've gone through some exercises on creating and consuming web services, but none of them looks quite like the SOAP description and the sample I've pasted below. Certainly, the "Hello World" example isn't qute the same! At this point, in a new VB.Net app, I've added the web reference correctly and I know how to connect to my SQL table and cycle through the rows in that table. I think I'm supposed to be executing something for each row of the SQL table, but I'm not sure what. I'm also not sure what to do about sending the password and username as part of the AuthHeader. Do I do that for each time I call the CreateNote service? I'm just not sure.
My theory is that, in pseudo code, it would look something like:
For each record in the SQL table
Set RecordVariable = Record from table
CreateNote ( RecordVariable("Comment_Type"), _
RecordVariable("Resort_Number"), _
RecordVariable("Account_Number"), _
RecordVariable("NoteText)
)
Next Record
However, I know this isn't even close to the correct syntax. As you can see below, there are two "Headers" I have no clue about putting information into different "headers" or what the code should look like that consumes this service. I know that for those of you experienced with web services, this is pretty easy stuff, so I apologize for being such a newbie at this. Any advice or samples - or even a reference to a similar (VERY similar) sample would be greatly appreciated.
Thanks!
Karen Grube
klgrube@yahoo.com
==========================================================
CreateNote
SOAP
The following is a sample SOAP request and response. The placeholders shown need to be replaced with actual values.
POST /Notes/Notes.asmx HTTP/1.1
Host: marchtest
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi=" xmlns:xsd=" xmlns:soap=" <soap:Header>
<AuthHeader xmlns=" <Username>string</Username>
<Password>string</Password>
</AuthHeader>
</soap:Header>
<soap:Body>
<CreateNote xmlns=" <Comment_Type>int</Comment_Type>
<Resort_Number>int</Resort_Number>
<Account_Number>int</Account_Number>
<Note_Text>string</Note_Text>
</CreateNote>
</soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi=" xmlns:xsd=" xmlns:soap=" <soap:Body>
<CreateNoteResponse xmlns=" <CreateNoteResult>int</CreateNoteResult>
</CreateNoteResponse>
</soap:Body>
</soap:Envelope>
==========================================================
========= Description ===================================
<?xml version="1.0" encoding="utf-8" ?>
- <definitions xmlns:http=" xmlns:soap=" xmlns:s=" xmlns:s0=" xmlns:soapenc=" xmlns:tm=" xmlns:mime=" targetNamespace=" xmlns="- <types>
- <s:schema elementFormDefault="qualified" targetNamespace="- <s:element name="CreateNote">
- <s:complexType>
- <s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="Comment_Type" type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="Resort_Number" type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="Account_Number" type="s:int" />
<s:element minOccurs="0" maxOccurs="1" name="Note_Text" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
- <s:element name="CreateNoteResponse">
- <s:complexType>
- <s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="CreateNoteResult" type="s:int" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="AuthHeader" type="s0:AuthHeader" />
- <s:complexType name="AuthHeader">
- <s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Username" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Password" type="s:string" />
</s:sequence>
</s:complexType>
</s:schema>
</types>
- <message name="CreateNoteSoapIn">
<part name="parameters" element="s0:CreateNote" />
</message>
- <message name="CreateNoteSoapOut">
<part name="parameters" element="s0:CreateNoteResponse" />
</message>
- <message name="CreateNoteAuthHeader">
<part name="AuthHeader" element="s0:AuthHeader" />
</message>
- <portType name="NotesSoap">
- <operation name="CreateNote">
<input message="s0:CreateNoteSoapIn" />
<output message="s0:CreateNoteSoapOut" />
</operation>
</portType>
- <binding name="NotesSoap" type="s0:NotesSoap">
<soap:binding transport=" style="document" />
- <operation name="CreateNote">
<soapperation soapAction=" style="document" />
- <input>
<soap:body use="literal" />
<soap:header message="s0:CreateNoteAuthHeader" part="AuthHeader" use="literal" />
</input>
- <output>
<soap:body use="literal" />
</output>
</operation>
</binding>
- <service name="Notes">
- <port name="NotesSoap" binding="s0:NotesSoap">
<soap:address location=" />
</port>
</service>
</definitions>
I hope someone can help! At work, I manage a SQL server. We also have an Oracle box. I have data in a SQL database that needs to be updated to a database in Oracle. Basically, I need to insert 250 records (four fields each) from a table in the SQL table into an already existing table in Oracle. The head of our IT department has provided me with a web service, but I really have no clue how to use it. I'm fairly new to VB.Net, and consuming a Web Service is a new programming task for me.
I've gone through some exercises on creating and consuming web services, but none of them looks quite like the SOAP description and the sample I've pasted below. Certainly, the "Hello World" example isn't qute the same! At this point, in a new VB.Net app, I've added the web reference correctly and I know how to connect to my SQL table and cycle through the rows in that table. I think I'm supposed to be executing something for each row of the SQL table, but I'm not sure what. I'm also not sure what to do about sending the password and username as part of the AuthHeader. Do I do that for each time I call the CreateNote service? I'm just not sure.
My theory is that, in pseudo code, it would look something like:
For each record in the SQL table
Set RecordVariable = Record from table
CreateNote ( RecordVariable("Comment_Type"), _
RecordVariable("Resort_Number"), _
RecordVariable("Account_Number"), _
RecordVariable("NoteText)
)
Next Record
However, I know this isn't even close to the correct syntax. As you can see below, there are two "Headers" I have no clue about putting information into different "headers" or what the code should look like that consumes this service. I know that for those of you experienced with web services, this is pretty easy stuff, so I apologize for being such a newbie at this. Any advice or samples - or even a reference to a similar (VERY similar) sample would be greatly appreciated.
Thanks!
Karen Grube
klgrube@yahoo.com
==========================================================
CreateNote
SOAP
The following is a sample SOAP request and response. The placeholders shown need to be replaced with actual values.
POST /Notes/Notes.asmx HTTP/1.1
Host: marchtest
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi=" xmlns:xsd=" xmlns:soap=" <soap:Header>
<AuthHeader xmlns=" <Username>string</Username>
<Password>string</Password>
</AuthHeader>
</soap:Header>
<soap:Body>
<CreateNote xmlns=" <Comment_Type>int</Comment_Type>
<Resort_Number>int</Resort_Number>
<Account_Number>int</Account_Number>
<Note_Text>string</Note_Text>
</CreateNote>
</soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi=" xmlns:xsd=" xmlns:soap=" <soap:Body>
<CreateNoteResponse xmlns=" <CreateNoteResult>int</CreateNoteResult>
</CreateNoteResponse>
</soap:Body>
</soap:Envelope>
==========================================================
========= Description ===================================
<?xml version="1.0" encoding="utf-8" ?>
- <definitions xmlns:http=" xmlns:soap=" xmlns:s=" xmlns:s0=" xmlns:soapenc=" xmlns:tm=" xmlns:mime=" targetNamespace=" xmlns="- <types>
- <s:schema elementFormDefault="qualified" targetNamespace="- <s:element name="CreateNote">
- <s:complexType>
- <s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="Comment_Type" type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="Resort_Number" type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="Account_Number" type="s:int" />
<s:element minOccurs="0" maxOccurs="1" name="Note_Text" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
- <s:element name="CreateNoteResponse">
- <s:complexType>
- <s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="CreateNoteResult" type="s:int" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="AuthHeader" type="s0:AuthHeader" />
- <s:complexType name="AuthHeader">
- <s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Username" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Password" type="s:string" />
</s:sequence>
</s:complexType>
</s:schema>
</types>
- <message name="CreateNoteSoapIn">
<part name="parameters" element="s0:CreateNote" />
</message>
- <message name="CreateNoteSoapOut">
<part name="parameters" element="s0:CreateNoteResponse" />
</message>
- <message name="CreateNoteAuthHeader">
<part name="AuthHeader" element="s0:AuthHeader" />
</message>
- <portType name="NotesSoap">
- <operation name="CreateNote">
<input message="s0:CreateNoteSoapIn" />
<output message="s0:CreateNoteSoapOut" />
</operation>
</portType>
- <binding name="NotesSoap" type="s0:NotesSoap">
<soap:binding transport=" style="document" />
- <operation name="CreateNote">
<soapperation soapAction=" style="document" />
- <input>
<soap:body use="literal" />
<soap:header message="s0:CreateNoteAuthHeader" part="AuthHeader" use="literal" />
</input>
- <output>
<soap:body use="literal" />
</output>
</operation>
</binding>
- <service name="Notes">
- <port name="NotesSoap" binding="s0:NotesSoap">
<soap:address location=" />
</port>
</service>
</definitions>