Fetstil Fetstil Kursiv Understrykning linje färgläggning tabellverk Punktlista Nummerlista Vänster Centrerat högerställt Utfyllt Länk Bild htmlmode
  • Forum & Blog
    • Forum - översikt
      • .Net
        • asp.net generellt
        • c#
        • vb.net
        • f#
        • silverlight
        • microsoft surface
        • visual studio .net
      • databaser
        • sql-server
        • databaser
        • access
        • mysql
      • mjukvara klient
        • datorer och komponenter
        • nätverk, lan/wan
        • operativsystem
        • programvaror
        • säkerhet, inställningar
        • windows server
        • allmänt
        • crystal reports
        • exchange/outlook
        • microsoft office
      • mjukvara server
        • active directory
        • biztalk
        • exchange
        • linux
        • sharepoint
        • webbservers
        • sql server
      • appar (win/mobil)
      • programspråk
        • c++
        • delphi
        • java
        • quick basic
        • visual basic
      • scripting
        • asp 3.0
        • flash actionscript
        • html css
        • javascript
        • php
        • regular expresssion
        • xml
      • spel och grafik
        • DirectX
        • Spel och grafik
      • ledning
        • Arkitektur
        • Systemutveckling
        • krav och test
        • projektledning
        • ledningsfrågor
      • vb-sektioner
        • activeX
        • windows api
        • elektronik
        • internet
        • komponenter
        • nätverk
        • operativsystem
      • övriga forum
        • arbete karriär
        • erbjuda uppdrag och tjänster
        • juridiska frågor
        • köp och sälj
        • matematik och fysik
        • intern information
        • skrivklåda
        • webb-operatörer
    • Posta inlägg i forumet
    • Chatta med andra
  • Konto
    • Medlemssida
    • Byta lösenord
    • Bli bonsumedlem
    • iMail
  • Material
    • Tips & tricks
    • Artiklar
    • Programarkiv
  • JOBB
  • Student
    • Studentlicenser
  • KONTAKT
    • Om pellesoft
    • Grundare
    • Kontakta oss
    • Annonsering
    • Partners
    • Felanmälan
  • Logga in

Hem / Forum översikt / inlägg

Posta nytt inlägg


Webservice och nuSoup?

Postades av 2007-03-12 09:22:24 - Jimmy Nilsson, i forum asp.net generellt, Tråden har 2 Kommentarer och lästs av 784 personer

Hej!

Jag har satt upp en väldigt enkel webservice enligt följande:

[WebService(Namespace = "http://test.net/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class companyService : System.Web.Services.WebService {

private companyDatabaseHandler dbHandler = new companyDatabaseHandler();

public companyService () {

//Uncomment the following line if using designed components
//InitializeComponent();
}

[WebMethod]
public string HelloWorld() {
return "Hello World";
}

[WebMethod]
public int getIdByGameName(string gameName)
{
try
{
if (gameName != null && gameName.Length > 0)
return dbHandler.getBoardGameGeekGameIdByGaneName(gameName);
throw (new Exception("gameName is not correct."));
}
catch (Exception ex)
{
throw ex;
}
}
}

Genom att köra denna lokalt och därmed få möjlighet att mata in ett namn för ett spel så kan jag se att webservicen fungerar som tänkt.

Tanken är att en PHP lösning ska kommunicera med denna webservice med hjälp av nuSoup med följande kod:

index.php
<?php
if (!isset($_POST['namn']))
{
echo '<form action="" method="post">';
echo 'Spelnamn: <input type="text" name="namn" />';
echo '<input type="submit"/>';
echo '</form>';
}
else
{
require_once('nusoap.php');

$wsdl = "companyService.wsdl";
$client = new soapclient($wsdl, 'wsdl');

$param = array(
'gameName' => $_POST['namn']
);

$result = $client->call('getIdByGameName', $param);

if ($err = $client->getError())
{
echo "The server returned error: $err";
}
else
{
echo "ID för spel med namn {$_POST['namn']} är: $result <br /><br />\n";
}
}
?>

Och WSDL dokumentet ser ut på följande vis(tänk på att denna innehåller en hel del mer än vad som används, detta för att jag klippt bort från koden oven sådant som är orelevant)

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://test.net/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://test.net/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://test.net/">
<s:element name="HelloWorld">
<s:complexType />
</s:element>
<s:element name="HelloWorldResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="HelloWorldResult" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="registerCompany">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="inName" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="inWebUrl" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="inDescription" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="inContactName" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="inContactPhoneNr" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="inContactEmailAdr" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="inPassword" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="registerCompanyResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="registerCompanyResult" type="s:int" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="getCompanyId">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="inName" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="getCompanyIdResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="getCompanyIdResult" type="s:int" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="removeCompany">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="inCompanyId" type="s:int" />
<s:element minOccurs="0" maxOccurs="1" name="inPassword" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="removeCompanyResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="removeCompanyResult" type="s:int" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="updateGame">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="inCompanyId" type="s:int" />
<s:element minOccurs="0" maxOccurs="1" name="inPassword" type="s:string" />
<s:element minOccurs="1" maxOccurs="1" name="inBoardGameGeekGameId" type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="inPriceEach" type="s:double" />
<s:element minOccurs="1" maxOccurs="1" name="inShippingPriceSweden" type="s:double" />
<s:element minOccurs="0" maxOccurs="1" name="inDirectLink" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="updateGameResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="updateGameResult" type="s:int" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="removeGame">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="inCompanyId" type="s:int" />
<s:element minOccurs="0" maxOccurs="1" name="inPassword" type="s:string" />
<s:element minOccurs="1" maxOccurs="1" name="inBoardGameGeekGameId" type="s:int" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="removeGameResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="removeGameResult" type="s:int" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="getCompanyGames">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="inCompanyId" type="s:int" />
<s:element minOccurs="0" maxOccurs="1" name="inPassword" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="getCompanyGamesResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="getCompanyGamesResult">
<s:complexType>
<s:sequence>
<s:any minOccurs="0" maxOccurs="unbounded" namespace="http://www.w3.org/2001/XMLSchema" processContents="lax" />
<s:any minOccurs="1" namespace="urn:schemas-microsoft-com:xml-diffgram-v1" processContents="lax" />
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="getIdByGameName">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="gameName" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="getIdByGameNameResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="getIdByGameNameResult" type="s:int" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="HelloWorldSoapIn">
<wsdl:part name="parameters" element="tns:HelloWorld" />
</wsdl:message>
<wsdl:message name="HelloWorldSoapOut">
<wsdl:part name="parameters" element="tns:HelloWorldResponse" />
</wsdl:message>
<wsdl:message name="registerCompanySoapIn">
<wsdl:part name="parameters" element="tns:registerCompany" />
</wsdl:message>
<wsdl:message name="registerCompanySoapOut">
<wsdl:part name="parameters" element="tns:registerCompanyResponse" />
</wsdl:message>
<wsdl:message name="getCompanyIdSoapIn">
<wsdl:part name="parameters" element="tns:getCompanyId" />
</wsdl:message>
<wsdl:message name="getCompanyIdSoapOut">
<wsdl:part name="parameters" element="tns:getCompanyIdResponse" />
</wsdl:message>
<wsdl:message name="removeCompanySoapIn">
<wsdl:part name="parameters" element="tns:removeCompany" />
</wsdl:message>
<wsdl:message name="removeCompanySoapOut">
<wsdl:part name="parameters" element="tns:removeCompanyResponse" />
</wsdl:message>
<wsdl:message name="updateGameSoapIn">
<wsdl:part name="parameters" element="tns:updateGame" />
</wsdl:message>
<wsdl:message name="updateGameSoapOut">
<wsdl:part name="parameters" element="tns:updateGameResponse" />
</wsdl:message>
<wsdl:message name="removeGameSoapIn">
<wsdl:part name="parameters" element="tns:removeGame" />
</wsdl:message>
<wsdl:message name="removeGameSoapOut">
<wsdl:part name="parameters" element="tns:removeGameResponse" />
</wsdl:message>
<wsdl:message name="getCompanyGamesSoapIn">
<wsdl:part name="parameters" element="tns:getCompanyGames" />
</wsdl:message>
<wsdl:message name="getCompanyGamesSoapOut">
<wsdl:part name="parameters" element="tns:getCompanyGamesResponse" />
</wsdl:message>
<wsdl:message name="getIdByGameNameSoapIn">
<wsdl:part name="parameters" element="tns:getIdByGameName" />
</wsdl:message>
<wsdl:message name="getIdByGameNameSoapOut">
<wsdl:part name="parameters" element="tns:getIdByGameNameResponse" />
</wsdl:message>
<wsdl:portType name="companyServiceSoap">
<wsdl:operation name="HelloWorld">
<wsdl:input message="tns:HelloWorldSoapIn" />
<wsdl:output message="tns:HelloWorldSoapOut" />
</wsdl:operation>
<wsdl:operation name="registerCompany">
<wsdl:input message="tns:registerCompanySoapIn" />
<wsdl:output message="tns:registerCompanySoapOut" />
</wsdl:operation>
<wsdl:operation name="getCompanyId">
<wsdl:input message="tns:getCompanyIdSoapIn" />
<wsdl:output message="tns:getCompanyIdSoapOut" />
</wsdl:operation>
<wsdl:operation name="removeCompany">
<wsdl:input message="tns:removeCompanySoapIn" />
<wsdl:output message="tns:removeCompanySoapOut" />
</wsdl:operation>
<wsdl:operation name="updateGame">
<wsdl:input message="tns:updateGameSoapIn" />
<wsdl:output message="tns:updateGameSoapOut" />
</wsdl:operation>
<wsdl:operation name="removeGame">
<wsdl:input message="tns:removeGameSoapIn" />
<wsdl:output message="tns:removeGameSoapOut" />
</wsdl:operation>
<wsdl:operation name="getCompanyGames">
<wsdl:input message="tns:getCompanyGamesSoapIn" />
<wsdl:output message="tns:getCompanyGamesSoapOut" />
</wsdl:operation>
<wsdl:operation name="getIdByGameName">
<wsdl:input message="tns:getIdByGameNameSoapIn" />
<wsdl:output message="tns:getIdByGameNameSoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="companyServiceSoap" type="tns:companyServiceSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="HelloWorld">
<soap:operation soapAction="http://test.net/HelloWorld" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="registerCompany">
<soap:operation soapAction="http://test.net/registerCompany" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getCompanyId">
<soap:operation soapAction="http://test.net/getCompanyId" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="removeCompany">
<soap:operation soapAction="http://test.net/removeCompany" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="updateGame">
<soap:operation soapAction="http://test.net/updateGame" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="removeGame">
<soap:operation soapAction="http://test.net/removeGame" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getCompanyGames">
<soap:operation soapAction="http://test.net/getCompanyGames" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getIdByGameName">
<soap:operation soapAction="http://test.net/getIdByGameName" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="companyServiceSoap12" type="tns:companyServiceSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="HelloWorld">
<soap12:operation soapAction="http://test.net/HelloWorld" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="registerCompany">
<soap12:operation soapAction="http://test.net/registerCompany" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getCompanyId">
<soap12:operation soapAction="http://test.net/getCompanyId" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="removeCompany">
<soap12:operation soapAction="http://test.net/removeCompany" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="updateGame">
<soap12:operation soapAction="http://test.net/updateGame" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="removeGame">
<soap12:operation soapAction="http://test.net/removeGame" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getCompanyGames">
<soap12:operation soapAction="http://test.net/getCompanyGames" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getIdByGameName">
<soap12:operation soapAction="http://test.net/getIdByGameName" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="companyService">
<wsdl:port name="companyServiceSoap" binding="tns:companyServiceSoap">
<soap:address location="http://localhost:1705/com/company/webservices/companyService.asmx" />
</wsdl:port>
<wsdl:port name="companyServiceSoap12" binding="tns:companyServiceSoap12">
<soap12:address location="http://localhost:1705/com/company/webservices/companyService.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

Denna lösning får kontakt med webservicen men det har visat sig att null kommer in på parametern, min tanke är att det kanske blir något fel med namespacet.

Kanske ni kan se felet?


Svara

Sv: Webservice och nuSoup?

Postades av 2007-03-12 16:30:56 - Jan Bulér

Är nog inte detta som är problemet men ska inte:

return dbHandler.getBoardGameGeekGameIdByGaneName(gameName);

vara

return dbHandler.getBoardGameGeekGameIdByGameName(gameName);

I ditt exempel strår det ...ByGaneName, det ska troligtvis vara ...ByGameNeme


Svara

Sv:Webservice och nuSoup?

Postades av 2007-03-13 15:41:16 - Jimmy Nilsson

Ja de e nog bara ett skriv fel från min sida, dock som du säger var det inte detta som ställde till det.

Istället vat det så att Webservicen genererar alla sina syper som complex types vilket ställer till det lite.

Genom att anropa webmetoderna genom att ange proxyn före så löser man detta problem.


Svara

Nyligen

  • 09:09 Vill du köpa medicinska tester?
  • 12:47 Vem beviljar assistansen – kommune
  • 14:17 Någon med erfarenhet av hemstädnin
  • 14:14 Bör man använda sig av en båtförme
  • 14:12 Finns det någon intressant hundblo
  • 14:25 Tips på verktyg för att skapa QR-k
  • 14:23 Tips på verktyg för att skapa QR-k
  • 20:52 Fungerer innskuddsbonuser egentlig

Sidor

  • Hem
  • Bli bonusmedlem
  • Läs artiklar
  • Chatta med andra
  • Sök och erbjud jobb
  • Kontakta oss
  • Studentlicenser
  • Skriv en artikel

Statistik

Antal besökare:
Antal medlemmar:
Antal inlägg:
Online:
På chatten:
4 569 170
27 953
271 705
640
0

Kontakta oss

Frågor runt konsultation, rådgivning, uppdrag, rekrytering, annonsering och övriga ärenden. Ring: 0730-88 22 24 | pelle@pellesoft.se

© 1986-2013 PelleSoft AB. Last Build 4.1.7169.18070 (2019-08-18 10:02:21) 4.0.30319.42000
  • Om
  • Kontakta
  • Regler
  • Cookies