Convert WSE3 Web Service Client Code to WCF
Hi. It would be much appreciated if an expert could be able to convert the following WSE3 web service client code to some working(well as much as possible) WCF code(preferable with configuration in code and entire code as short as can be) please? I've seen some examples using the ChannelFactory class but there may be a cleaner/shorter way.
The 3rd Party web service being called is: HTTPS, EndPoint is ASMX file, SOAP 1.1, and using ws-security. The working WSE3 code is:
Dim ExpCertificate As New X509Certificate2
ExpCertificate = New X509Certificate2("<pfx file>", "<password>")
Dim waspservice As New TokenService
waspservice.ClientCertificates.Add(ExpCertificate)
waspservice.Url = "https://somesite.asmx"
Dim res As String = waspservice.STS("<WASPAuthenticationRequest><ApplicationName>Example Client</ApplicationName><AuthenticationLevel>CertificateAuthentication</AuthenticationLevel><AuthenticationParameters/></WASPAuthenticationRequest>")
Response.Write(res & vbCrLf & vbCrLf)
An example soap request is:
<wsse:Security>
<wsu:Timestampwsu:Id="Timestamp-2b27a32b-ca9c-4405-b377-4444f63c8f29">
<wsu:Created>2011-02-20T16:36:54Z</wsu:Created>
<wsu:Expires>2011-02-20T16:41:54Z</wsu:Expires>
</wsu:Timestamp>
<wsse:BinarySecurityToken ValueType="CompanyWASP" EncodingType="wsse:Base64Binary" wsu:Id="SecurityToken-f64439f9-c12c-4d09-ac3d-fc478ad19775">MjAtRTctQ0YtMTUtN0EtODEtNTk.</wsse:BinarySecurityToken>
</wsse:Security>
</soap:Header>
<soap:Body>
<! -- SOAP content for the service call -- >
</soap:Body>
The WSDL is:
<wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://www.uk.company.com/WASP/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="http://www.uk.company.com/WASP/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://www.uk.company.com/WASP/">
<s:element name="STS">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="authenticationBlock" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="STSResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="STSResult" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="string" nillable="true" type="s:string" />
</s:schema>
</wsdl:types>
<wsdl:message name="STSSoapIn">
<wsdl:part name="parameters" element="tns:STS" />
</wsdl:message>
<wsdl:message name="STSSoapOut">
<wsdl:part name="parameters" element="tns:STSResponse" />
</wsdl:message>
<wsdl:message name="STSHttpGetIn">
<wsdl:part name="authenticationBlock" type="s:string" />
</wsdl:message>
<wsdl:message name="STSHttpGetOut">
<wsdl:part name="Body" element="tns:string" />
</wsdl:message>
<wsdl:message name="STSHttpPostIn">
<wsdl:part name="authenticationBlock" type="s:string" />
</wsdl:message>
<wsdl:message name="STSHttpPostOut">
<wsdl:part name="Body" element="tns:string" />
</wsdl:message>
<wsdl:portType name="TokenServiceSoap">
<wsdl:operation name="STS">
<wsdl:input message="tns:STSSoapIn" />
<wsdl:output message="tns:STSSoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:portType name="TokenServiceHttpGet">
<wsdl:operation name="STS">
<wsdl:input message="tns:STSHttpGetIn" />
<wsdl:output message="tns:STSHttpGetOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:portType name="TokenServiceHttpPost">
<wsdl:operation name="STS">
<wsdl:input message="tns:STSHttpPostIn" />
<wsdl:output message="tns:STSHttpPostOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="TokenServiceSoap" type="tns:TokenServiceSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
<wsdl:operation name="STS">
<soap:operation soapAction="http://www.uk.company.com/WASP/STS" 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="TokenServiceHttpGet" type="tns:TokenServiceHttpGet">
<http:binding verb="GET" />
<wsdl:operation name="STS">
<http:operation location="/STS" />
<wsdl:input>
<http:urlEncoded />
</wsdl:input>
<wsdl:output>
<mime:mimeXml part="Body" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="TokenServiceHttpPost" type="tns:TokenServiceHttpPost">
<http:binding verb="POST" />
<wsdl:operation name="STS">
<http:operation location="/STS" />
<wsdl:input>
<mime:content type="application/x-www-form-urlencoded" />
</wsdl:input>
<wsdl:output>
<mime:mimeXml part="Body" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="TokenService">
<documentation xmlns="http://schemas.xmlsoap.org/wsdl/">company Token Service</documentation>
<wsdl:port name="TokenServiceSoap" binding="tns:TokenServiceSoap">
<soap:address location="https://secure.authenticator.uat.uk.company.com/WaspAuthenticator/TokenService.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Generate proxy class either of using
wsdl.exe OR by adding service reference in visual studio. That will create required proxy.
Proxy will have methods which you want to call. Pass in required parameters and you should be good.
Related
I'm using WCF client in this very simple way:
using (var client = new ExampleService_TestClient())
{
client.ClientCredentials.UserName.UserName = "user";
client.ClientCredentials.UserName.Password = "pass";
var request = new ExampleService_TestRequest(requestData);
var response = client.ExampleService_Test(request);
// response.Response_MT is null
// when it should have errorMsg="OK"
}
The data is sent correctly.
However the response property errorMsg is null.
Here is the envelope:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Inbound_MT xmlns="https://example.com/ExampeService/">
<event_id xmlns="">1</event_id>
<event_name xmlns="">insert</event_name>
<event_date xmlns="">2017-06-22 16:09</event_date>
<employee_number xmlns="">666</employee_number>
<employee_first_name xmlns="">Chuck</employee_first_name>
<employee_last_name xmlns="">Inserted Norris</employee_last_name>
</Inbound_MT>
</s:Body>
</s:Envelope>
The response I see using fiddler:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Header></soap:Header><soap:Body><Response_MT>
<errorMsg>OK</errorMsg>
</Response_MT></soap:Body>
</soap:Envelope>
WSDL:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:p1="https://example.com/ExampeService/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" targetNamespace="https://example.com/ExampeService/">
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="https://example.com/ExampeService/" targetNamespace="https://example.com/ExampeService/">
<xsd:element name="Inbound_MT" type="Inbound_DT" />
<xsd:element name="Response_MT" type="Response_DT" />
<xsd:complexType name="Inbound_DT">
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="event_id" type="xsd:integer" />
<xsd:element maxOccurs="1" minOccurs="1" name="event_name" type="xsd:string" />
<xsd:element maxOccurs="1" minOccurs="1" name="event_date" type="xsd:string" />
<xsd:element maxOccurs="1" minOccurs="1" name="employee_number" type="xsd:string" />
<xsd:element maxOccurs="1" minOccurs="0" name="employee_first_name" type="xsd:string" />
<xsd:element maxOccurs="1" minOccurs="0" name="employee_last_name" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Response_DT">
<xsd:sequence>
<xsd:element name="errorMsg" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<wsdl:message name="Inbound_MT">
<wsdl:documentation />
<wsdl:part element="p1:Inbound_MT" name="Inbound_MT" />
</wsdl:message>
<wsdl:message name="Response_MT">
<wsdl:documentation />
<wsdl:part element="p1:Response_MT" name="Response_MT" />
</wsdl:message>
<wsdl:portType name="ExampleService_Test">
<wsdl:documentation />
<wsdl:operation name="ExampleService_Test">
<wsdl:documentation />
<wsdl:input message="p1:Inbound_MT" />
<wsdl:output message="p1:Response_MT" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ExampleService_TestBinding" type="p1:ExampleService_Test">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<wsp:Policy>
<wsp:PolicyReference URI="#BN__binding" />
</wsp:Policy>
<wsdl:operation name="ExampleService_Test">
<soap:operation soapAction="https://example.com/ExampeService//ExampleService_Test" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="SOME_GREAT_SERVICE">
<wsdl:documentation>WS_GS</wsdl:documentation>
<wsdl:port binding="p1:ExampleService_TestBinding" name="ExampleService_Test">
<soap:address location="https://endpointaddress/cxf/ExampleService_Test" />
</wsdl:port>
</wsdl:service>
<wsp:UsingPolicy required="true" />
<wsp:Policy wsu:Id="BN__binding">
<wsp:ExactlyOne>
<wsp:All>
<sp:TransportBinding xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702">
<wsp:Policy>
<sp:TransportToken>
<wsp:Policy>
<sp:HttpsToken>
<wsp:Policy>
<wsp:ExactlyOne>
<sp:HttpBasicAuthentication />
<sp:RequireClientCertificate />
</wsp:ExactlyOne>
</wsp:Policy>
</sp:HttpsToken>
</wsp:Policy>
</sp:TransportToken>
<sp:AlgorithmSuite>
<wsp:Policy>
<wsp:ExactlyOne>
<sp:Basic256 />
<sp:Basic192 />
<sp:Basic128 />
<sp:TripleDes />
<sp:Basic256Rsa15 />
<sp:Basic192Rsa15 />
<sp:Basic128Rsa15 />
<sp:TripleDesRsa15 />
<sp:Basic256Sha256 />
<sp:Basic192Sha256 />
<sp:Basic128Sha256 />
<sp:TripleDesSha256 />
<sp:Basic256Sha256Rsa15 />
<sp:Basic192Sha256Rsa15 />
<sp:Basic128Sha256Rsa15 />
<sp:TripleDesSha256Rsa15 />
</wsp:ExactlyOne>
</wsp:Policy>
</sp:AlgorithmSuite>
<sp:Layout>
<wsp:Policy>
<sp:Strict />
</wsp:Policy>
</sp:Layout>
</wsp:Policy>
</sp:TransportBinding>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
</wsdl:definitions>
Based on your wsdl it looks like your return is XML and not an object (I didn't see a data contract). Since the response is XML, you cannot refer directly to the response variable with dot-notation. You need to first parse the response into an object you can understand and inspect.
Have you set a break-point on var response to see if it is a string containing the XML?
You can do something like this and immediately access nodes of the response using xpath:
var response = new XmlDocument();
response.LoadXml(client.ExampleService_Test(request));
var errorMsg = response.SelectSingleNode("//Response_MT/errorMsg");
I'm using MS wsdl.exe to generate C# file from a WSDL file, but get a error describes that "the element attribute is required for headers when Use=Literal"
How can I get rid of this? Is there any other tools to generate C# from wsdl?
<message name="SomeHeader">
<part name="Version" type="xsd:string"/>
</message>
....
<operation name="xxxxx">
<soap:operation soapAction="xxxx"/>
<input>
<soap:header use="literal" message="SomeHeader" part="Version" />
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
I finally resolved this issue by replace "type" with "element".
Modified above wsdl to
<wsdl:types>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://tempuri.org/"
elementFormDefault="qualified">
<xsd:element name="Version" type="xsd:string"/>
....
....
</xsd:schema>
</wsdl:types>
<message name="SomeHeader">
<part name="Version" element="tns:Version"/>
</message>
Im trying to consume a web service using the below WSDL from a .NET C# project.
I've added the web reference etc and tried invoking the method (getPatients) but it always returns an error:
"MyService.PatientType[] PatientService.getPatients(MyService.getPatients getPatients1)"
"No overload for method 'getPatients' takes 0 arguments"
I thought my code was ok (same as I've used successfully before) but I must be doing something wrong...
MyService.PatientService ws = new MyService.PatientService();
string message = ws.getPatients();
Does anyone have any ideas?
Thanks
WSDL:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions name="patient"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.example.org/patientservice/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:p1="http://www.example.org/patientservice/patient_types/"
targetNamespace="http://www.example.org/patientservice/">
<wsdl:types>
<xsd:schema targetNamespace="http://www.example.org/patientservice/patient_types/"
xmlns:tns="http://www.example.org/patientservice/patient_types/"
xmlns:ns1="http://www.example.org/patient"
elementFormDefault="qualified">
<xsd:complexType name="patientType">
<xsd:sequence>
<xsd:element name="name" type="xsd:string"/>
<xsd:element name="age" type="xsd:int"/>
<xsd:element name="ssn" type="xsd:string"/>
<xsd:element name="pid" type="xsd:int"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="getPatients">
<xsd:complexType/>
</xsd:element>
<xsd:element name="getPatientsResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="patient" type="tns:patientType" maxOccurs="unbounded" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="getPatient">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ssn" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="getPatientResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="patient" type="tns:patientType"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="getPatientsRequest">
<wsdl:part element="p1:getPatients" name="in"/>
</wsdl:message>
<wsdl:message name="getPatientsResponse">
<wsdl:part element="p1:getPatientsResponse" name="out"/>
</wsdl:message>
<wsdl:message name="getPatientRequest">
<wsdl:part name="in" element="p1:getPatient"></wsdl:part>
</wsdl:message>
<wsdl:message name="getPatientResponse">
<wsdl:part name="out" element="p1:getPatientResponse"></wsdl:part>
</wsdl:message>
<wsdl:portType name="patient">
<wsdl:operation name="getPatients">
<wsdl:input message="tns:getPatientsRequest"/>
<wsdl:output message="tns:getPatientsResponse"/>
</wsdl:operation>
<wsdl:operation name="getPatient">
<wsdl:input message="tns:getPatientRequest"></wsdl:input>
<wsdl:output message="tns:getPatientResponse"></wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="patientSOAP" type="tns:patient">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getPatients">
<soap:operation style="document" soapAction=""/>
<wsdl:input name="getPatientsRequest">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getPatientsResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getPatient">
<soap:operation style="document" soapAction=""/>
<wsdl:input name="getPatientRequest">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getPatientResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="PatientService">
<wsdl:port binding="tns:patientSOAP" name="PatientSOAPPort">
<soap:address location="http://192.168.100.1:8080/patientservice"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
I've generated a proxy against the wsdl and it seems the method getPatients takes a parameter.
try this:
PatientService ws = new PatientService();
getPatients getPatients1 = new getPatients();
patientType[] patients = ws.getPatients(getPatients1);
I'm using Visual Studio 2010, .Net4, Silverlight(4.0.50826.0).
I created a WCF service and I`m trying to create a proxy with SlSvcUtil like:
SlSvcUtil.exe /serializer:DataContractSerializer http://192.128.09.26:8080/Server?wsdl /out:C:\Projets\Client\dService.cs /config:C:\Projets\Client\ServiceReferences.ClientConfig
When I add some methods with customer type and also they have some attributes I got this msg:
Warning: The optional WSDL extension element 'body' from namespace
'http://schemas.xmlsoap.org/wsdl/soap/' was not handled.
XPath:
//wsdl:definitions[#targetNamespace='http://tempuri.org/']/wsdl:binding[#
name='BasicHttpBinding_IService']/wsdl:operation[#name='GetDefinitionsHavingFre']/wsdl:output
If I ignore the warning and I try to use the class I get a NullException error when I call any method.
If I change the option /Serializer:XmlSerializer or any other option Its possible create the proxy correctly but I get a lot of null references in the visual studio, so Its necessary to add the correct .dll.
If I add: System.ServiceModel from Silverlight -the xmlserializerformatattribute doesn't exist System.ServiceModel from .NET -the ChannelBase doesn't exist
If I didn't use the customer method my service works fine, so my question is has silverlight some limit when use customer types or methods with attributes ?
Someone has some clue what could be done to solve this ?
Thanks,
WSDL:
<?xml version="1.0" encoding="utf-8" ?>
- <wsdl:definitions name="TestService" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex">
- <wsdl:types>
- <xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="http://192.128.09.26:8080/Server?xsd=xsd0" namespace="http://tempuri.org/" />
<xsd:import schemaLocation="http://192.128.09.26:8080/Server?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
<xsd:import schemaLocation="http://192.128.09.26:8080/Server?xsd=xsd10" namespace="http://schemas.datacontract.org/2004/07/DataCompany.Data.Faults" />
<xsd:import schemaLocation="http://192.128.09.26:8080/Server?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/DataCompany.Data.PortalModel" />
<xsd:import schemaLocation="http://192.128.09.26:8080/Server?xsd=xsd3" namespace="http://schemas.datacontract.org/2004/07/System.Data.Objects.DataClasses" />
<xsd:import schemaLocation="http://192.128.09.26:8080/Server?xsd=xsd4" namespace="http://schemas.datacontract.org/2004/07/System.Data" />
<xsd:import schemaLocation="http://192.128.09.26:8080/Server?xsd=xsd5" namespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays" />
<xsd:import schemaLocation="http://192.128.09.26:8080/Server?xsd=xsd6" namespace="http://schemas.datacontract.org/2004/07/DataCompany.Data.Components" />
<xsd:import schemaLocation="http://192.128.09.26:8080/Server?xsd=xsd7" namespace="http://schemas.datacontract.org/2004/07/System" />
<xsd:import schemaLocation="http://192.128.09.26:8080/Server?xsd=xsd8" namespace="http://schemas.datacontract.org/2004/07/DataCompany.Data" />
<xsd:import schemaLocation="http://192.128.09.26:8080/Server?xsd=xsd9" namespace="http://schemas.datacontract.org/2004/07/DataCompany.Data.LocalizationManagement" />
</xsd:schema>
</wsdl:types>
- <wsdl:message name="ITestService_StatusService_InputMessage">
<wsdl:part name="parameters" element="tns:StatusService" />
</wsdl:message>
- <wsdl:message name="ITestService_StatusService_OutputMessage">
<wsdl:part name="parameters" element="tns:StatusServiceResponse" />
</wsdl:message>
- <wsdl:message name="ITestService_getData_InputMessage">
<wsdl:part name="parameters" element="tns:getData" />
</wsdl:message>
- <wsdl:message name="ITestService_getData_OutputMessage">
<wsdl:part name="parameters" element="tns:getDataResponse" />
</wsdl:message>
- <wsdl:message name="ITestService_getTime_InputMessage">
<wsdl:part name="parameters" element="tns:getTime" />
</wsdl:message>
- <wsdl:message name="ITestService_getTime_OutputMessage">
<wsdl:part name="parameters" element="tns:getTimeResponse" />
</wsdl:message>
- <wsdl:message name="ITestService_getText_InputMessage">
<wsdl:part name="parameters" element="tns:getText" />
</wsdl:message>
- <wsdl:message name="ITestService_getText_OutputMessage">
<wsdl:part name="parameters" element="tns:getTextResponse" />
</wsdl:message>
- <wsdl:message name="ITestService_SaveEntity_InputMessage">
<wsdl:part name="parameters" element="tns:SaveEntity" />
</wsdl:message>
- <wsdl:message name="ITestService_SaveEntity_OutputMessage">
<wsdl:part name="parameters" element="tns:SaveEntityResponse" />
</wsdl:message>
- <wsdl:message name="ITestService_SaveEntity_DatabaseFaultFault_FaultMessage">
<wsdl:part name="detail" element="q1:DatabaseFault" xmlns:q1="http://schemas.datacontract.org/2004/07/DataCompany.Data.Faults" />
</wsdl:message>
- <wsdl:portType name="ITestService">
- <wsdl:operation name="StatusService">
<wsdl:input wsaw:Action="http://tempuri.org/ITestService/StatusService" message="tns:ITestService_StatusService_InputMessage" />
<wsdl:output wsaw:Action="http://tempuri.org/ITestService/StatusServiceResponse" message="tns:ITestService_StatusService_OutputMessage" />
</wsdl:operation>
- <wsdl:operation name="getData">
<wsdl:input wsaw:Action="http://tempuri.org/ITestService/getData" message="tns:ITestService_getData_InputMessage" />
<wsdl:output wsaw:Action="http://tempuri.org/ITestService/getDataResponse" message="tns:ITestService_getData_OutputMessage" />
</wsdl:operation>
- <wsdl:operation name="getTime">
<wsdl:input wsaw:Action="http://tempuri.org/ITestService/getTime" message="tns:ITestService_getTime_InputMessage" />
<wsdl:output wsaw:Action="http://tempuri.org/ITestService/getTimeResponse" message="tns:ITestService_getTime_OutputMessage" />
</wsdl:operation>
- <wsdl:operation name="getText">
<wsdl:input wsaw:Action="http://tempuri.org/ITestService/getText" message="tns:ITestService_getText_InputMessage" />
<wsdl:output wsaw:Action="http://tempuri.org/ITestService/getTextResponse" message="tns:ITestService_getText_OutputMessage" />
</wsdl:operation>
- <wsdl:operation name="SaveEntity">
<wsdl:input wsaw:Action="http://tempuri.org/ITestService/SaveEntity" message="tns:ITestService_SaveEntity_InputMessage" />
<wsdl:output wsaw:Action="http://tempuri.org/ITestService/SaveEntityResponse" message="tns:ITestService_SaveEntity_OutputMessage" />
<wsdl:fault wsaw:Action="http://tempuri.org/ITestService/SaveEntityDatabaseFaultFault" name="DatabaseFaultFault" message="tns:ITestService_SaveEntity_DatabaseFaultFault_FaultMessage" />
</wsdl:operation>
</wsdl:portType>
- <wsdl:binding name="BasicHttpBinding_ITestService" type="tns:ITestService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="StatusService">
<soap:operation soapAction="http://tempuri.org/ITestService/StatusService" style="document" />
- <wsdl:input>
<soap:body use="literal" />
</wsdl:input>
- <wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
- <wsdl:operation name="getData">
<soap:operation soapAction="http://tempuri.org/ITestService/getData" style="document" />
- <wsdl:input>
<soap:body use="literal" />
</wsdl:input>
- <wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
- <wsdl:operation name="getTime">
<soap:operation soapAction="http://tempuri.org/ITestService/getTime" style="document" />
- <wsdl:input>
<soap:body use="literal" />
</wsdl:input>
- <wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
- <wsdl:operation name="getText">
<soap:operation soapAction="http://tempuri.org/ITestService/getText" style="document" />
- <wsdl:input>
<soap:body use="literal" />
</wsdl:input>
- <wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
- <wsdl:operation name="SaveEntity">
<soap:operation soapAction="http://tempuri.org/ITestService/SaveEntity" style="document" />
- <wsdl:input>
<soap:body use="literal" />
</wsdl:input>
- <wsdl:output>
<soap:body use="literal" />
</wsdl:output>
- <wsdl:fault name="DatabaseFaultFault">
<soap:fault name="DatabaseFaultFault" use="literal" />
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
- <wsdl:service name="TestService">
- <wsdl:port name="BasicHttpBinding_ITestService" binding="tns:BasicHttpBinding_ITestService">
<soap:address location="http://192.128.09.26:8080/Server" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
I Found the problem.
After creating the proxy with SlSvcUtil and adding the .cs in my project in Visual Studio I got this error:
The type or namespace name 'XmlSerializerFormatAttributeAttribute' does not exist in the namespace 'System.ServiceModel' (are you missing an assembly reference?)
First of all I tried change the System.Service.Model from the Silverlight version to the .Net version, but I got other errors.
So I found somewhere that was necessary, use /serializer:DataContractSerializer in the SlSvcUtil; after that this error was solved. However I got a WSDL warning when the proxy is generated.
SOLUTION
I created the proxy using the following command:
SlSvcUtil.exe http://192.128.09.26:8080/Server /out:C:\Projets\Client\dService.cs /config:C:\Projets\Client\ServiceReferences.ClientConfig
Then the I got this error in Visual Studio:
The type or namespace name 'XmlSerializerFormatAttributeAttribute' does not exist in the namespace 'System.ServiceModel' (are you missing an assembly reference?)
I added the following dll:
System.Xml.Serialization.dll - (Runtime Version v2.0.50727)
Conclusion
Visual Studio wasn't able to find the reference inside the ServiceModel.dll and the ServiceModel was there so I never thought to add another .dll because the correct dll was already added.
Just yesterday I tried add the System.Xml.Serialization.dll and now everthing works fine.
I have php web service. and can consume it from php client.
But problem occurs when i try call from c# win app.
Do you have any ideas..
Problem is it returns null, also i cannot see it from object browser
My wsdl file
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:ns0="http://1sunucu.com" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://1sunucu.com">
<wsdl:types>
<xs:schema xmlns:ns="http://1sunucu.com" xmlns:ns1="http://1sunucu.com/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://HighSchool.edu">
<xs:element name="ExamResult">
<xs:complexType>
<xs:sequence>
<xs:element name="kullaniciKod" type="xs:string"/>
<xs:element name="sifre" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="ExamResultResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="result" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
<wsdl:message name="ExamResultRequest">
<wsdl:part name="parameters" element="ns0:ExamResult"/>
</wsdl:message>
<wsdl:message name="ExamResultResponse">
<wsdl:part name="parameters" element="ns0:ExamResultResponse"/>
</wsdl:message>
<wsdl:portType name="ExamResultPortType">
<wsdl:operation name="ExamResult">
<wsdl:input message="ns0:ExamResultRequest" wsaw:Action="urn:ExamResult"/>
<wsdl:output message="ns0:ExamResultResponse" wsaw:Action="urn:ExamResultResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ExamResultSOAP12Binding" type="ns0:ExamResultPortType">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="ExamResult">
<soap12:operation soapAction="urn:ExamResult" 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="ExamResult">
<wsdl:port name="ExamResultSOAP12port_http" binding="ns0:ExamResultSOAP12Binding">
<soap12:address location="http://localhost/ws/soap-server.php"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Thanks to SoapUi. i have solved the problem...There was a response error in php server