By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,534 Members | 950 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,534 IT Pros & Developers. It's quick & easy.

Consume PHP Soap web services using the .net Web Reference/proxy

P: 1
I am coding in a visual studio 2008 (vb.net) web application & I am trying to access a clients php soap services through the .net web service proxy.

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
  1. Dim articleService3 As articleService.ArticleServiceService = New articleService.ArticleServiceService()
  2.  Dim myCredentials As New System.Net.CredentialCache
  3. Dim myNetCred As New NetworkCredential("****", "****")
  4. myCredentials.Add(New Uri("http://teamie.webcat3.web-catalogue.eu/service/webcat/articleService"), "Basic", myNetCred)
  5.  'articleService3.UseDefaultCredentials = False ???
  6.  articleService3.PreAuthenticate = True
  7. articleService3.Credentials = myCredentials
I am unsure as to whether this is working or not because I have not been able to actually add the data I need using the articleService Function createOwnArticle

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
  1.  
  2. Dim artId As Integer = 9
  3. Dim tecdocArticleId as integer = 1
  4. Dim artDesc As String = ""
  5. Dim artNotes As String = "Notes for text article 9"
  6. Dim artNumber As String = "TEST0009"
  7. Dim dealerID As Integer = 9
  8. Dim node As Xml.XmlNode        
  9. node = articleService3.createOwnArticle(artId, tecdocArticleId, artDesc, artNotes, artNumber, dealerID)
  10.  
The xml created when trying to do this via soapUI software is as follows:

<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!!!!
Dec 3 '13 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.