In an existing .net web project I have added a web Reference to the clients php soap service named articleService at the following location http://teamie.webcat3.web-catalogue.eu/service/webcat/articleService
Everything appears to be fine. I can view the articleService in the object browser.
The first thing I need to do is add header username & password authentication,
I have coded the following so far:
Expand|Select|Wrap|Line Numbers
- Dim articleService3 As articleService.ArticleServiceService = New articleService.ArticleServiceService()
- Dim myCredentials As New System.Net.CredentialCache
- Dim myNetCred As New NetworkCredential("****", "****")
- myCredentials.Add(New Uri("http://teamie.webcat3.web-catalogue.eu/service/webcat/articleService"), "Basic", myNetCred)
- 'articleService3.UseDefaultCredentials = False ???
- articleService3.PreAuthenticate = True
- articleService3.Credentials = myCredentials
What I need to do is add an article via the articleService function createOwnArticle
Parameter of CreateOwnArticleRequest
This returns
CreateOwnArticleResponse
If you view the wsdl file in a browser you can see the definitions below:
<definitions name="ArticleService" targetNamespace="urn:ArticleServicewsdl"><wsdl:typ es><xsd:schema targetNamespace="urn:ArticleServicewsdl"><xsd:comp lexType name="CreateOwnArticleRequest"><xsd:all><xsd:eleme nt name="article" type="tns:NewOwnArticle"/></xsd:all></xsd:complexType><xsd:complexType name="NewOwnArticle"><xsd:all><xsd:element minOccurs="0" maxOccurs="1" nillable="true" name="id" type="xsd:integer"/><xsd:element name="tecdocArticleId" type="xsd:integer"/><xsd:element name="description" type="xsd:string"/><xsd:element name="notes" type="xsd:string"/><xsd:element name="articleNumber" type="xsd:string"/><xsd:element name="dealerId" type="xsd:integer"/></xsd:all></xsd:complexType><xsd:complexType name="CreateOwnArticleResponse"><xsd:all><xsd:elem ent minOccurs="0" maxOccurs="1" nillable="false" name="article" type="tns:ExistingOwnArticle"/><xsd:element name="errors" type="tns:ErrorArray"/></xsd:all></xsd:complexType><xsd:complexType name="ExistingOwnArticle"><xsd:all><xsd:element name="tecdocArticleId" type="xsd:integer"/><xsd:element name="description" type="xsd:string"/><xsd:element name="notes" type="xsd:string"/><xsd:element name="id" type="xsd:integer"/><xsd:element name="articleNumber" type="xsd:string"/><xsd:element name="dealerId" type="xsd:integer"/></xsd:all></xsd:complexType>
Or you can view the added webservice objects in the .net object browser.
The big issue is I don’t actually know how to pass the data I need into articleService function createOwnArticle
If this was consuming a .net webservice it would be as easy as the code below however that is the code below is returning error “Value of type Integer cannot be converted to TecDoc.articleService.CreateOwnArticleRequest”
Expand|Select|Wrap|Line Numbers
- Dim artId As Integer = 9
- Dim tecdocArticleId as integer = 1
- Dim artDesc As String = ""
- Dim artNotes As String = "Notes for text article 9"
- Dim artNumber As String = "TEST0009"
- Dim dealerID As Integer = 9
- Dim node As Xml.XmlNode
- node = articleService3.createOwnArticle(artId, tecdocArticleId, artDesc, artNotes, artNumber, dealerID)
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:ArticleServicewsdl">
<soapenv:Header/>
<soapenv:Body>
<urn:createOwnArticle soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<request xsi:type="urn:CreateOwnArticleRequest" xs:type="type:CreateOwnArticleRequest" xmlns:xs="http://www.w3.org/2000/XMLSchema-instance">
<article xsi:type="urn:NewOwnArticle" xn:type="urn:ArticleServicewsdl" xmlns:xn="http://www.w3.org/2000/xmlns/">
<!--You may enter the following 6 items in any order-->
<!--Optional:-->
<id xsi:type="xsd:integer" xs:type="type:integer">7</id>
<tecdocArticleId xsi:type="xsd:integer" xs:type="type:integer">1</tecdocArticleId>
<description xsi:type="xsd:string" xs:type="type:string">Test Article Desc 7</description>
<notes xsi:type="xsd:string" xs:type="type:string">Test Notes 7</notes>
<articleNumber xsi:type="xsd:string" xs:type="type:string">TEST0007</articleNumber>
<dealerId xsi:type="xsd:integer" xs:type="type:integer">1</dealerId>
</article>
</request>
</urn:createOwnArticle>
</soapenv:Body>
</soapenv:Envelope>
It’s like a need to declare some type of object for CreateOwnArticleResponse & populate it with data but I’ve no idea how to do this.
Other relevant information
The content of the actual HTTP header sent to the clients server (as generated by SOAP UI software):
POST
http://teamie.webcat3.web-catalogue.eu/en/service/webcat/articleService?ws=1
HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: "urn:ArticleServicewsdl#getOwnArticleList"
Content-Length: 1458
Host: teamie.webcat3.web-catalogue.eu
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
Cookie: WEBCAT4_TEAMIE=7991b6a06cf71cd73bced1620aad50ef
Cookie2: $Version=1
Authorization: Basic dGVhbWllQHRlYW1pZS5jb206QTFkOTNUMU4=
I am Under huge pressure to get this working, testing was required last week & I can't even get the first web service function working! Please Help!!!!