i want to use a web Service(WSDL) in my WPF App.
i have add it as a Service Reference to my app.
Code to call it is as :
ServiceReference1.WebService_ISB_SAB_Interface_ExtSoapClient soap =
new ServiceReference1.WebService_ISB_SAB_Interface_ExtSoapClient();
ServiceReference1.Request requestObj = new ServiceReference1.Request();
requestObj.UserID = "1001002_S1234534H";
requestObj.DomainName = "XXXX";
requestObj.MessageContent = "<PcpsChronicBalanceEnquiry>" +
"<Request>" +
"<PatientNric>S1234534H</PatientNric>" +
"<Year>2015</Year>" +
"<BillType>C</BillType>" +
"</PcpsChronicBalanceEnquiry>";
var ss = soap.Operation_1(requestObj);
But i dint get any response.
App.Config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="WebService_ISB_SAB_Interface_ExtSoap">
<security mode="Transport">
<transport clientCredentialType="Windows" />
</security>
</binding>
<binding name="WebService_ISB_SAB_Interface_ExtSoap1" />
<binding name="ISB_SAB_Orchestration_Orchestration_1_Port_SAB_RequestSoap" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://u103-vw-bzap01.tst.cleo.sg:9320/ws/ISB_SAB_Interface_Ext_Proxy/ISB_SAB_Interface_Ext.asmx"
binding="basicHttpBinding" bindingConfiguration="WebService_ISB_SAB_Interface_ExtSoap"
contract="ServiceReference1.WebService_ISB_SAB_Interface_ExtSoap"
name="WebService_ISB_SAB_Interface_ExtSoap" />
<endpoint address="http://192.168.9.34/ISB_SAB_Interface_Proxy/ISB_SAB_Orchestration_Orchestration_1_Port_SAB_Request.asmx"
binding="basicHttpBinding" bindingConfiguration="ISB_SAB_Orchestration_Orchestration_1_Port_SAB_RequestSoap"
contract="ServiceReference2.ISB_SAB_Orchestration_Orchestration_1_Port_SAB_RequestSoap"
name="ISB_SAB_Orchestration_Orchestration_1_Port_SAB_RequestSoap" />
</client>
</system.serviceModel>
it throws exception as
"An unhandled exception of type 'System.ServiceModel.EndpointNotFoundException' occurred in mscorlib.dll
Additional information: There was no endpoint listening at https://u103-vw-bzap01.tst.cleo.sg:9320/ws/ISB_SAB_Interface_Ext_Proxy/ISB_SAB_Interface_Ext.asmx that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details."
Please help to resolve.
Related
I have a code that calls SAP PI Webservice with the following config file:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="VMSUpdateVehicleMasterProcessing_Out_SyncBinding">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Basic"/>
</security>
</binding>
<binding name="VMSUpdateVehicleMasterProcessing_Out_SyncBinding1">
<security mode="Transport" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://gtsapgwqas.tmp.local:50000/XISOAPAdapter/MessageServlet?senderParty=&senderService=VMSPlantMaintenance_Q&receiverParty=&receiverService=&interface=VMSUpdateVehicleMasterProcessing_Out_Sync&interfaceNamespace=urn%3ATMP.com%3AERP%3APlantMaintenance%3ACreateUpdateVehicleMaster"
binding="basicHttpBinding" bindingConfiguration="VMSUpdateVehicleMasterProcessing_Out_SyncBinding"
contract="VMService.VMSUpdateVehicleMasterProcessing_Out_Sync"
name="HTTP_Port" />
</client>
</system.serviceModel>
</configuration>
To create an instance to use the method in this webservice, I just use:
VMService.VMSUpdateVehicleMasterProcessing_Out_SyncClient c = new VMSUpdateVehicleMasterProcessing_Out_SyncClient();
Then, when calling the method, I just use:
VehicleMasterResponse response = c.VMSUpdateVehicleMasterProcessing_Out_Sync(vm);
This works perfectly as I am able to pass updates and receive the appropriate response. My Problem is, I have to implement this in SSIS. SSIS does not recognize app.config so I tried to create my Basic HTTP Binding. Unfortunately, "Server Error" is always thrown when I call the well method...
Here is how I set up my binding and instance:
var binding = new BasicHttpBinding();
binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
var addess = new EndpointAddress("http://gtsapgwqas.tmp.local:50000/XISOAPAdapter/MessageServlet?senderParty=&senderService=VMSPlantMaintenance_Q&receiverParty=&receiverService=&interface=VMSUpdateVehicleMasterProcessing_Out_Sync&interfaceNamespace=urn%3ATMP.com%3AERP%3APlantMaintenance%3ACreateUpdateVehicleMaster");
VMService.VMSUpdateVehicleMasterProcessing_Out_SyncClient c = new VMSUpdateVehicleMasterProcessing_Out_SyncClient(binding, addess);
c.ClientCredentials.UserName.UserName = "NAME";
c.ClientCredentials.UserName.Password = "PWORD";
Basically I just supplied the properties that is in the config file... What causes the Server Error and how to solve this problem?
I am trying connect to wcf service. I dont have access to it. It has credentials and SSL (https).
try
{
var stub = new ServiceReference1.ServiceClient();
stub.ClientCredentials.UserName.UserName = "user";
stub.ClientCredentials.UserName.Password = "pass";
stub.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.PeerOrChainTrust;
stub.getData("Test");
}
catch (Exception ee)
{
}
app.config:
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1"/>
</startup>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService">
<security mode="Transport">
<transport clientCredentialType="Basic" proxyCredentialType="Basic" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://address/path/service.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService"
contract="ServiceReference1.IService" name="BasicHttpBinding_IService" />
</client>
</system.serviceModel>
Error I got:
An error occurred while making the HTTP request to https://address/path/Service.svc. This should be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caused by a mismatch of the security binding between the client and the server.
What I am doing wrong??? Do I need something add to app.config?? I guess that something with certificate is not good???
I have added wcf service in "Windows Service" as service reference. but when i try to create instance it simply gives me following error
"Could not find default endpoint element that references contract
'ServiceReference1.IClientService' in the ServiceModel client
configuration section. This might be because no configuration file was
found for your application, or because no endpoint element matching
this contract could be found in the client element."
Code
pushNotification push_notification = new pushNotification();
var proxy = new ServiceReference1.ClientServiceClient();
using (var scope = new OperationContextScope(proxy.InnerChannel))
{
// Add a HTTP Header to an outgoing request
HttpRequestMessageProperty requestMessage = new HttpRequestMessageProperty();
requestMessage.Headers["Authorization"] = "Push Notification";
OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = requestMessage;
push_notification = proxy.GetPendingNotification();
}
app.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService1" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:4567/ClientService.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IService1" contract="ServiceReference1.IClientService"
name="BasicHttpBinding_IService1" behaviorConfiguration="webHttpBehavior" />
</client>
<behaviors>
<endpointBehaviors>
<behavior name="webHttpBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
Be sure you put the endpoint information in your main App.config or Web.config.
If you've added the service reference in a separate project you need to copy the config:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService1" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:4567/ClientService.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IService1" contract="ServiceReference1.IClientService"
name="BasicHttpBinding_IService1" />
</client>
</system.serviceModel>
In your startup project App.config/Web.config!
I am getting this error while invoking a method of my web service, I dont know what to do anymore :s
Here is the exception details:
{"The provided URI scheme 'http' is invalid; expected
'https'.\r\nParameter name: via"}
Here is my App.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<connectionStrings>
<add name="PowerWeb" connectionString="Data Source=MYSERVER;Initial Catalog=MYTABLE;User ID=MYUSER;Password=MYPW" providerName="System.Data.SqlClient" />
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<system.serviceModel>
<bindings>
<customBinding>
<binding name="ZWS_HARMONIZACAO">
<!-- WsdlImporter encountered unrecognized policy assertions in ServiceDescription 'urn:sap-com:document:sap:rfc:functions': -->
<!-- <wsdl:binding name='ZWS_HARMONIZACAO'> -->
<!-- <saptrnbnd:OptimizedXMLTransfer xmlns:saptrnbnd="http://www.sap.com/webas/710/soap/features/transportbinding/">..</saptrnbnd:OptimizedXMLTransfer> -->
<!-- <saptrnbnd:OptimizedXMLTransfer xmlns:saptrnbnd="http://www.sap.com/webas/710/soap/features/transportbinding/">..</saptrnbnd:OptimizedXMLTransfer> -->
<!-- <sapattahnd:Enabled xmlns:sapattahnd="http://www.sap.com/710/features/attachment/">..</sapattahnd:Enabled> -->
<textMessageEncoding messageVersion="Soap11" />
<httpsTransport authenticationScheme="Basic" />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="http://mydomain:8080/sap/bc/srt/rfc/sap/zws_harmonizacao/010/zws_harmonizacao/zws_harmonizacao"
binding="customBinding" bindingConfiguration="ZWS_HARMONIZACAO"
contract="ServiceReference1.ZWS_HARMONIZACAO" name="ZWS_HARMONIZACAO" />
</client>
</system.serviceModel>
</configuration>
Can anyone help me?
Thanks a lot in advance
You are specifying an httpsTransport in the binding, but in the endpoint definition you are providing http as a protocol. As suggested in the comment, try changing the <endpoint address="http://... to https
I have changed the configuration of the binding like this:
var binding = new BasicHttpBinding(BasicHttpSecurityMode.None);
var address = new EndpointAddress(url);
var client = new MobileServiceClient.MobileServiceClient(binding, address);
The endpoint address is like:
http://server101.local/MobileService.svc
And it works.
Change from Transport to None
If configuration is part of Code
BasicHttpSecurityMode.Transport to BasicHttpSecurityMode.None
2.If configuration is part of web.config
<security mode="Transport">
</security>
to
<security mode="None">
</security>
I had the same problem y one project. Simply in your config file change the line:
<httpsTransport authenticationScheme="Basic" />
to
<httpTransport authenticationScheme="Basic" />
And all ok, because your endpoint is http.
[Solved] Change from Transport to None
If configuration is part of code
BasicHttpSecurityMode.Transport to
BasicHttpSecurityMode.None
I have a WCF service which is supposed to return a List to my client application. One of the columns in the database are byte[]. When I try to return this list of Object, I only get a NetDispatcherFaultException with this inner-exception:
"The maximum array length quota (16384) has been exceeded while
reading XML data. This quota may be increased by changing the
MaxArrayLength property on the XmlDictionaryReaderQuotas object used
when creating the XML reader. Line 1, position 38697."
I have googled after this and found a that I should increase the maxArrayLength in the web.config, so I did:
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https"/>
<add binding="basicHttpBinding" scheme="http"
bindingConfiguration="CrudserviceBinding" />
</protocolMapping>
<bindings>
<basicHttpBinding>
<binding name="CrudserviceBinding" maxReceivedMessageSize="52428800" >
<readerQuotas maxStringContentLength="10242880"
maxArrayLength="10242880" />
</binding>
</basicHttpBinding>
</bindings>
This is my app.config on the client side:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_ICrudService">
<readerQuotas maxStringContentLength="5242880"
maxArrayLength="52428800" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost/My.Project/CrudService.svc"
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_ICrudService"
contract="MobileCrudService.ICrudService"
name="BasicHttpBinding_ICrudService" />
</client>
</system.serviceModel>
</configuration>
When I try this once more, the WCF service returns the same exception. Can anybody explain how I should deal with this?
If you are calling the service in a class Library on the Client, make sure you are changing the actual Application .config file. Do not use
Products/ProductName/Main/Source/Project_Name/bin/Debug/ProjectName.dll.config
instead use
Products/ProductName/Main/Source/Project_EXE_Name/bin/Debug/YourExe.config