Quantcast
Channel: WCF, ASMX and other Web Services
Viewing all 555 articles
Browse latest View live

Asmx file with method name.

$
0
0
Without web reference or service reference i want to get method output.
I have something like http://asp.asmx?getname="vs",dss
Using httpwebrequest i want to get method output.how can i do?need examples

.Net WCF service deploy error in IIS

$
0
0

With IIS installed and running w/ the localhost address functional, I have a WCF service.svc that I'm trying to deploy in IIS. I created an IIS application under the Default Web Site for the service using the .net 4.5 application pool, but when I try to browse the .svc file from within the IIS manager, the browser reports the following error "localhost is currently unable to handle this request".

If I click browse on the .svc file from within VS using iisexpress it resolves correctly to the WSDL metadata page and if I create an IIS application using the path in Visual Studio where the service folder resides it works and the url resolves. I don't understand why after I publish the service to another folder location and deploy this location that it doesn't work in IIS. Somehow it seems tied to the Visual Studio installed location.

Can someone help me understand why this is? I need to be able to publish this service along w/ the associated bin files to another client system and have it work. 

Web.config

<?xml version="1.0" encoding="utf-8"?><configuration><startup><supportedRuntimeversion="v4.0"sku=".NETFramework,Version=v4.5"/></startup><appSettings></appSettings><system.serviceModel><client/><bindings><basicHttpBinding><bindingname="basicHttpBinding_testLink"maxReceivedMessageSize="20000000"/></basicHttpBinding></bindings><behaviors><serviceBehaviors><behavior><!-- To avoid disclosing metadata information, set the values below to false before deployment --><serviceMetadatahttpGetEnabled="true"httpsGetEnabled="true"/><!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information --><serviceDebugincludeExceptionDetailInFaults="false"/></behavior></serviceBehaviors></behaviors><!-- Service endpoints to expose/consume --><services><servicename="testLink.testManager"><endpointaddress="testService"binding="basicHttpBinding"bindingConfiguration="basicHttpBinding_testLink"contract="testLink.ITestManager"/><endpointaddress="mex"binding="mexHttpBinding"contract="IMetadataExchange"/></service></services><protocolMapping><addbinding="basicHttpBinding"scheme="http"/></protocolMapping><serviceHostingEnvironmentaspNetCompatibilityEnabled="false"multipleSiteBindingsEnabled="true"/></system.serviceModel></configuration>

Tnx in advance.

Can a WebService be part or my web site and run under the SSL of the site?

$
0
0

I am thinking the WebService runs on a separate port anyway.

But it sounds too good to be true?

Length of parameters

$
0
0

Hi,

I have 2 .NET 3.5 web services.

Let's call them WS1 and WS2.

WS1 is basically a web services acting as a proxy for WS2 methods

I have a case where in WS1 one method stopped answering with a time out error when one of the string-typed parameter reached a certain content's size

WS1.MyMethod(string A, int Id) calls WS2.MyMethod(string A, int Id) and return a time out error if A is reaching a certain amount of characters

If I call WS2.MyMethod(string A, int Id) with the same parameters through the web services test web page it works perfectly.

How do I increase the allowed size of message when WS1 calls WS2 ?

Best regards

Greg

Consume Web service using C#

$
0
0

Hi All,

I need to consume one web service in my C# application through Visual Studio.
I have been provided one URL of web service and an Access Token for that.

Kindly suggest me how do I consume in my App.

Thanks
Gautam

web service (asmx) The remote server returned an unexpected response: (999) No Hacking

$
0
0

The remote server returned an unexpected response: (999) No Hacking 

web service i use it in desktop application sometimes show that error and sometimes not
I don't knew the reason

and i use this code to hide webservice.asmx

 <webServices>
        <protocols>
          <remove name="Documentation" />
        </protocols>
      </webServices>

Parameter count mismatch

$
0
0
Hi
I have webservice that works fine.when i create it as static object

Public static object webser(string asmxurl,string methodname,string service,obj ()args)
Webclient c=new webclient();
Stream str=c.openread(asmxurl);

Servicedescription ds= new servicedescription.read(str);
Invoke webservice
Methodinfo mi=wsvcc.gettype().getmethod(methodname);
Return mi.invoke(wsvcc.args);error here.

WCF current documentation

$
0
0

Hi

I am looking into WCF and notice a lot of the documentation appears quite dated and has been written for Server 2003 / Server 2008 / Windows 7 and I can't really find fresh documentation updated for more recent versions of Windows.

If I wanted to get some basic samples going by following the tutorials at 

https://docs.microsoft.com/en-us/dotnet/framework/wcf/

https://docs.microsoft.com/en-us/dotnet/framework/wcf/getting-started-tutorial

https://docs.microsoft.com/en-us/dotnet/framework/wcf/samples/getting-started-sample

https://docs.microsoft.com/en-us/dotnet/framework/wcf/samples/one-time-setup-procedure-for-the-wcf-samples

would this be the correct place to start?

Also if I was starting from a completely fresh machine from scratch eg an Azure virtual machine with Server 2016 and Visual Studio 2017 installed, with nothing else, what would be the easiest way of getting a sample WCF application up and running?  It's just that the Microsoft pages jump about from one place to another and cater for so many scenarios I want to be careful of not following down the wrong rabbit hole!

What I'm looking for is a start-me-up guide just to start from zero, follow the instructions and get my first 'hello world' WCF client/server application up and running, just to see the mechanics of how it all fits together in practice.

Final question - is the industry in general using APIs rather than WCF technology, or is WCF still used by major companies?

Thanks!

Phil Anderson


SOAP web references over https

$
0
0

There is a bunch of current web references in my WPF application that were generated using the "add web reference" option in Visual Studio. However I am trying to enforce https on callings these web services using TLS1.2 (already done work on server side). I have done all the cert imports and I can access the WSDL over https fine on the web browsers. Application works if I enable tls1.0 on the server side, but when I disable I just get the error occurred on send "An existing connection was forcibly closed by the remote host". Is there a setting I have to set in the app.config to enforce tls1.2?

Consume Web service using SoapClient

$
0
0

Hi All,

I need to consume Soap web service in my C# application using SoapClient, 

Kindly suggest me how do I pass all these parameters in my App.

Thanks

<OTA_ReadRQ PrimaryLangID="en" Version="0"><POS><Source AgentDutyCode="XXXX"><RequestorID Type="XX" MessagePassword="XXXX"/></Source></POS><ReadRequests><ReadRequest><UniqueID ID="XXXX"/></ReadRequest></ReadRequests></OTA_ReadRQ>

Help regarding Web Service

$
0
0

Asalam Alaikum(Greetings)!

I have a question about the web services. I create a web service on my system. in which i run a batch file on my root directory of C. When i run service the bat file is running. My question is that if i call web service from other PC, will my bat file run through my service or not.

Thank you,

Regards,
Muhammad Naveed Haroon

WCF programming attribute is not allowed

$
0
0

Hello everyone,

I am tinkering a little bit with WCF-service programming and tried to configure a CustomBinding in the web.config of the project in Visual Studio.

I looked at https://docs.microsoft.com/de-de/dotnet/framework/configure-apps/file-schema/wcf/issuedtokenparameters but can not use the attribute inclusionMode and also some others which are shown in the docs. VS tells me "The inclusionMode-attribute is now allowed".

How can I use it or what am I missing that I cannot use it?

Yours

Could not find a base address that matches scheme http for the endpoint with binding WebHttpBinding. Registered base address schemes are [https].

$
0
0

Hello Friends,

My Web.config File are given below:-

<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="DBConnectionString" connectionString="Data Source=SIVA\SQLEXPRESS2012;Failover Partner=SIVA\SQLEXPRESS2012;Initial Catalog=FuelBuddy;Persist Security Info=True;User ID=sa;Password=mssql;MultipleActiveResultSets=True;Connection Timeout=30; Min Pool Size=20;Max Pool Size=100" />
</connectionStrings>
<appSettings>

</appSettings>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<!--<clear/>-->
<add name="UrlRoutingModule"
type="System.Web.Routing.UrlRoutingModule,
System.Web.Routing, Version=4.0.0.0,
Culture=neutral,
PublicKeyToken=31BF3856AD364E35" />
</modules>
<handlers>
<add name="UrlRoutingHandler"
preCondition="integratedMode"
verb="*" path="UrlRouting.axd"
type="System.Web.HttpForbiddenHandler,
System.Web, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" />
</handlers>
</system.webServer>
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
<bindings>
<webHttpBinding>
<binding name="SecureWebBinding">
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None" />
</security>
</binding>

</webHttpBinding>
</bindings>
<services>
<service name="NSFuelBuddyServices.FuelBuddyService"
behaviorConfiguration="RESTBehavior">
<endpoint address=""
binding="webHttpBinding" bindingConfiguration="SecureWebBinding"
contract="NSFuelBuddyServices.IFuelBuddyService"
behaviorConfiguration="MyEndpointBehavior"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="RESTBehavior">
<serviceMetadata httpGetEnabled="false"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="MyEndpointBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>

</system.serviceModel>
</configuration>

they successfully build but on executing WCF Service Host They give following error:-

System.InvalidOperationException: Could not find a base address that matches scheme http for the endpoint with binding WebHttpBinding. Registered base address schemes are [https].
at System.ServiceModel.ServiceHostBase.MakeAbsoluteUri(Uri relativeOrAbsoluteUri, Binding binding, UriSchemeKeyedCollection baseAddresses)
at System.ServiceModel.Description.ConfigLoader.LoadServiceDescription(ServiceHostBase host, ServiceDescription description, ServiceElement serviceElement, Action`1 addBaseAddress, Boolean skipHost)
at System.ServiceModel.ServiceHostBase.LoadConfigurationSectionInternal(ConfigLoader configLoader, ServiceDescription description, ServiceElement serviceSection)
at System.ServiceModel.ServiceHostBase.ApplyConfiguration()

System.Web.HttpException The type 'WebService.WebService' is ambiguous: it could come from assembly A or B

$
0
0

The type 'WebService.WebService' is ambiguous: it could come from assembly 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\be16cd76\fad287b\App_Code.rwr4wlid.DLL' or from assembly 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\be16cd76\fad287b\App_WebReferences.2_hrkewk.DLL'. Please specify the assembly explicitly in the type name.

I have the same error message when I run the WebService.asmx local except that it points to an asp.net temp folder.

There are two sites, each having a WebService, each has their own port no.

The live sites are on a shared server.

The WebService.asmx file looks the same on each site:

<%@ WebService Language="C#" CodeBehind="~/App_Code/WebService.cs" Class="WebService.WebService" %>

The WebService.cs class is also the same, here are the first few lines:

namespace WebService
{
    /// <summary>
    /// Web Service Namespace="http://developer.intuit.com/"
    /// Web Service Name="WebService"
    /// Web Service Description="Sample WebService in ASP.NET to 
    /// demonstrate QuickBooks WebConnector"
    /// </summary>
    [WebService(
         Namespace = "http://developer.intuit.com/",
         Name = "WebService",
         Description = "Sample WebService in ASP.NET to demonstrate " +"QuickBooks WebConnector")]

    // Important Note: 	
    // You should keep the namespace as http://developer.intuit.com/ for all web 
    // services that communicates with QuickBooks Web Connector. 


    public class WebService : System.Web.Services.WebService
    {
        #region GlobalVariables
        System.Diagnostics.EventLog evLog = new System.Diagnostics.EventLog();
        public int count = 0;
        public ArrayList req = new ArrayList();
        public static int theprovider = -1;

        #endregion

        #region Constructor
        public WebService()
        {
            //CODEGEN: This call is required by the ASP.NET 
            //Web Services Designer
            InitializeComponent();
            // Initializing EventLog for logging
            initEvLog();
        }
        #endregion

        #region AutoGeneratedMethods
        //Required by the Web Services Designer 
        private IContainer components = null;

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
        }

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            if (disposing && components != null)
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #endregion


        #region WebMethods

The error message says "Please specify the assembly explicitly in the type name."

No clue what this means. Where and how? 

Soap web service attribute question

$
0
0

Hi,

I'm new on web service and I'm trying to make web service to pass id and password like below

<ns:POS><!--Zero or more repetitions:--><ns:Source ><!--Optional:--><ns:RequestorID RequestorID="?"  RequestorPassword="?"><!--Optional:--></ns:RequestorID><!--Optional:--></ns:Source></ns:POS>

but what I find is as below

<tem:POS><!--Optional:--><tem:Source><!--Optional:--><tem:RequestorID>?</tem:RequestorID><!--Optional:--><tem:RequestorPassword>?</tem:RequestorPassword></tem:Source><!--Optional:--><tem:RequestorName>?</tem:RequestorName></tem:POS>

here below the code so far 

    public class MyWebService : System.Web.Services.WebService
    {
        public class Source
        {
            public string RequestorID;
            public string RequestorPassword;
        }

        public class POS
        {
            public Source Source;
        }


        public class ReadRQ
        {
            public POS POS;
        }


        [WebMethod]
        public void ReadService(ReadRQ ReadRQ)
        {
        }

    }


How to save Image in HTML5 canvas to Oracle database through javaScript and ASMX web service ?

$
0
0

Hello,

I have a web page (HTML5) where a picture is present inside a canvas. On button click I (through jQuery/javaScript) I need to save the Image to oracle database via ASMX web service. Please help how to achieve this.

How to fix below service error after login to application ?

$
0
0

Hi Experts,

I am facing Issue that while browsing my service it's redrecting to login page (which is correct) but once i am giving user id and password and click on login it showing below error message,

Server Error in '/STS' Application.

The header 'Security' from the namespace 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd' was not understood by the recipient of this message, causing the message to not be processed.  This error typically indicates that the sender of this message has enabled a communication protocol that the receiver cannot process.  Please ensure that the configuration of the client's binding is consistent with the service's binding.

I have already google this error and get a result as,

https://social.msdn.microsoft.com/Forums/vstudio/en-US/e23fe0fe-4143-4a7a-b9c4-38528ed07c51/the-header-security-error?forum=wcf

https://forums.asp.net/t/2013068.aspx?Header+security+error+message+in+WCF+client

but none of the results works for me, still geting same error message.

Can anybody help me to resolve this error.

Thanks lot for yuur help.

SK.

Cannot remove escape characters from SOAP message

$
0
0

I have tried several different routines to serialize my XML and each time, after converting to string I get a series of escape characters that are causing problems when POSTing this message to the endpoint.

<Envelope xmlns=\"http://schemas.xmlsoap.org/soap/envelope/\">

<Body>

<GetMyData xmlns=\"stuff\">

I have tried Replace I have tried RegEx.Unescape and I cannot remove these escapes. When I run this XML either from code (HttpWebRequest) or from SOAPui with the escapes it fails with a 500. If I remove the escapes it works fine. Any help is appreciated.

Class libraries using Web services WSDL link

$
0
0

Hello,

    I am trying to use a web service from c# dll and after going through many blogs and articles I have gave up.  I am trying to find a way to do it.  I just want to post some values to the WSDL and want to get some response from it.  How to achieve this in C# (I am from DB background) ?. Any link or code sample can be helpful to me.  All I want to do is pass the required values from C# to XML(Web service WSDL) and get some value in return, but how to do and where to start is something I am trying to figure out.

System.Net.Sockets.SocketException (0x80004005): A connection attempt failed because the connected party did not properly respond after a period of time

$
0
0

Hi,

I have been battling this for weeks. I want to read xml string from an rss feed. It works fine on localhost and postman, but after i publish and deploy using FTP to the server, i get this error.

Unable to connect to the remote server at System.Net.HttpWebRequest.GetResponse() at dayrunnerapp.Controllers.HomeController.callRss(String url) System.Net.Sockets.SocketException (0x80004005): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 52.1.31.92:80 at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)

This is the function that reads the feed

[WebMethod, AllowCrossSiteJson]
        private string callRss(string url)
        {
            string html = String.Empty;
            try
            {
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
                request.AutomaticDecompression = DecompressionMethods.GZip;
                request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0.2) Gecko/20100101 Firefox/6.0.2";
                request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
                request.Headers.Add("Accept-Language", "en-gb,en;q=0.5");
                request.Headers.Add("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7");
                WebRequest.DefaultWebProxy.Credentials = CredentialCache.DefaultNetworkCredentials;
                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                using (Stream stream = response.GetResponseStream())
                using (StreamReader reader = new StreamReader(stream))
                {
                    html = reader.ReadToEnd();
                }
            }
            catch (Exception ex)
            {
                html = ex.Message+"\n"+ex.StackTrace + "\n" + ex.InnerException + "\n" + ex.InnerException.InnerException;
            }

            return html;
        }

this is the feed url 

var url = "http://www.inboundlogistics.com/cms/rss-feed";

here is part of my web.config file

<system.net><defaultProxy useDefaultCredentials="true" /></system.net>

Please what am i missing?

Viewing all 555 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>