none
WCF calling ASMX Web service RRS feed

  • Question

  • Call i collect response from the asmx web service inside the wcf service ? I know i have to generate the proxy classes or add service reference but when creating the instance of the generated class i don't want to create an application like 

    console or asp.net . 

    I am just trying to  collect the reponse from the asmx webservice directly  inside wcf. 

    Thanks. 


    usher A

    Wednesday, March 14, 2018 3:03 AM

Answers

All replies

  • Yes, a WCF service project can consume a legacy ASMX service as a client, just like any other client type like Windows desktop, Console, ect.  and ect. project type can consume a ASMX Web service. There is no difference on how any .NET project type, even an ASMX service project  acting as a client to and consuming another ASMX service  consumes the service.

    It's all the same way no matter how you do it by service reference in the project or by proxy classes. But it's best you use service reference in the project, IMO.

    Wednesday, March 14, 2018 5:02 AM
  • Thanks for you reply .

    But for e.g in a console client i have a main application where i create the instance of the proxy class .

    Then i call appropriate functions inside the console main() and it does the job.

    So where exactly in the service 1 where i have added reference to service2 as a proxy i can create instances of service2 proxy and call the functions like i can call inside the windows console main().

    How will I test my service ? Do i have to create client like console , asp.net . 

    What will be the execution point ? 

    Can i store data in a database directly through  service1 (referencing service2) 

    by passing console or windows forms application ?

    This is confusing me a bit .

    Thanks



    usher A


    • Edited by usher227 Wednesday, March 14, 2018 6:08 AM
    Wednesday, March 14, 2018 5:42 AM
  • Hi usher,

    >> So where exactly in the service 1

    It depends on when you will call Service2 from Service1. In general, you use Service2 generated proxy in Service method.

    >> Do i have to create client like console

    You could create a console app to call Service1.

    >> Can i store data in a database directly through  service1 (referencing service2) by passing console or windows forms application ?

    WCF is a service, you should send request to WCF to call method. If not, the WCF Service method would not fire.

    It seems you need windows Service to call WCF Service instead of WCF calls WCF Service.

    Tao Zhou


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, March 14, 2018 8:55 AM
  • So where exactly in the service 1 where i have added reference to service2 as a proxy i can create instances of service2 proxy and call the functions like i can call inside the windows console main().

    I myself, I would abandon using the proxy approach and set a service reference in the WCF service project and make the call without using proxy classes.

    https://msdn.microsoft.com/en-us/library/bb628649.aspx?f=255&MSPPError=-2147217396

    https://www.tutorialspoint.com/asp.net/asp.net_web_services.htm

    How will I test my service ? Do i have to create client like console , asp.net . 

    What will be the execution point ? 

    I would assume that that would be one point at startup where it calls methods in the console application that tests each Web method on the service that has been publically exposed.

    Can i store data in a database directly through  service1 (referencing service2) 

    Yes, service1 can call methods on service2 directly. Sevice2  methods could be using the Repository pattern for CRUD operations with the database using the ADO.NET Entity Framework and using the DTO pattern to pass data between the two services.

    https://en.wikipedia.org/wiki/Data_transfer_object

    https://www.codeproject.com/Articles/1050468/Data-Transfer-Object-Design-Pattern-in-Csharp

    https://msdn.microsoft.com/en-us/library/ff649690.aspx?f=255&MSPPError=-2147217396

    https://www.youtube.com/watch?v=rtXpYpZdOzM

    https://elegantcode.com/2007/12/05/fun-with-generics-from-repository-to-dto/

    by passing console or windows forms application ?

    The console application will work with the DTO  pattern and test the service  for doing CRUD (create, read, update and delete) operations with the database using EF and the Repository pattern.

    • Marked as answer by usher227 Monday, March 19, 2018 4:16 PM
    Wednesday, March 14, 2018 11:04 AM
  • Hi 

    I have a scenario . I have been given a wsdl from my customer to define my web service according to that .

    I will be sending a request object to the customer's server through their form  with my web service url address.

    They will use my web service url that i have sent to them to push the response to us.

    My confusion is how will they push the response object when they are not consuming my web service. 

    I am using their WSDL to collect the response but how will they know where to send it . 

    How will I expose something in my end point that they know  ? Only I am sending my web service url to them .


    usher A

    Monday, March 19, 2018 4:23 PM
  • I have a scenario . I have been given a wsdl from my customer to define my web service according to that .

    Yeah, you can have a client define the public signature of Web methods that your service exposes.

     ! will be sending a request object to the customer's server through their form  with my web service url address.

    It seems that the party you talk about is a client and not a service.

    If this is the case, the client must make the initial contact with the service, using a request object that is sent to the service. And in turn. your Web service sends a response object back to the client. It's called the request/response pattern.

    My confusion is how will they push the response object when they are not consuming my web service. 

    I can't see how that is possible, since it is the client that must make the initial contact with the Web service on a solicitation of  traffic between the client and the service, the request/response. This is the traditional pattern of communications between the client and the service  where the client must make the initial contact with the service before communications will commence between the two.

    I am using their WSDL to collect the response but how will they know where to send it . 

    How will I expose something in my end point that they know  ? Only I am sending my web service url to them .

    If it's a traditional ASP.NET WCF Web service, then there is a WCF client program that consumes the ASP.NET WCF Web service. The client program that is hosting the WCF client side components must know the endpoint to the ASP.NET WCF Web Service, which is done traditionally through a  config file.

    It seems to me that you have some kind of miscommunications here that you need to clarify  with this other party, unless your Web service is a client to their Web service, and you were given the WSDL to consume their Web service and there is no form involved here that you have mentioned.

    Tuesday, March 20, 2018 4:14 AM