locked
In what kind of situation people has to create proxy in wcf or asmx web service RRS feed

  • Question

  • User264732274 posted

    most of the time web service company provide wsdl or endpoint address url as a result client can create proxy but tell me few situation when web service company do not like to provide wsdl or endpoint address url to client to create proxy.

    please tell me few scenario where user has to create proxy dynamically? thanks

    Monday, November 28, 2016 12:26 PM

Answers

  • User475983607 posted

    most of the time web service company provide wsdl or endpoint address url as a result client can create proxy but tell me few situation when web service company do not like to provide wsdl or endpoint address url to client to create proxy.

    please tell me few scenario where user has to create proxy dynamically? thanks

    You've asked similar questions over the last several months.  

    A proxy is code generated by Visual Studio when creating a web reference.  Essentially VS is parsing a WSDL.  If the WSDL is not available then you can't very well create a proxy. Similarly, if there is no endpoint then there is no way to communicate with the service as an endpoint is one of the three things needed to communicate with a WCF service.

    I strongly suggest that you take the time necessary to learn the technology rather than post leading questions that have no relevance.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, November 28, 2016 2:11 PM
  • User475983607 posted

    sudip_inn

    suppose when developer working with VS if they do not have wsdl or endpoint address then how they can create proxy dynamically for web service ?

    Asking the question twice will not change the response.  If the WSDL does not exist then it is not possible to create a proxy.  If the endpoint does not exist you can't access the service.

    sudip_inn

    at least developer should have some thing to create proxy dynamically for web service . so tell me what developer must have to create proxy dynamically for web service to call. thanks

    Incorrect!  The  WSDL (Web Services Description Language) is what's used to create a proxy.  That's what a WSDL is for... there is no super secrete method for creating a proxy. 

    Otherwise a developer needs the service source code and service contracts.  Hopefully the service is on the same platform as the developers platform.  From there the developer would NOT create a proxy!  The developer would programmatically invoke the WCF interface using a channel factory - assuming .NET.

    https://msdn.microsoft.com/en-us/library/ms734681(v=vs.110).aspx

    Again, you need to start reading documentation so you can ask relevant questions. I have referred you to many WCF references and it seems that you have not taken the time to learn because you keep asking the same questions every few months.  This is a support forum for folks that want to learn and move forward.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, November 29, 2016 12:32 PM
  • User475983607 posted

    sudip_inn

    when using channel factory then why we need to use SvcUtil ? can u plzz tell me the reason if u know.

    For the third time, you don't need to use the Svcutil if you have the source code.  If you don't have the source code then you need the WSDL.  If don't have the source code or the WSDL then you can't communicate with the service.

    I use a channel factory without a proxy for internal WCF messaging all the time.  There is no need to create a proxy if the WCF service is not exposed to the public.

    https://www.codeproject.com/tips/558163/difference-between-proxy-and-channel-factory-in-wc

    sudip_inn

    see this endpoint address EndpointAddress myEndpoint = new EndpointAddress("http://localhost/MathService/Ep1");

    endpoint url looks different there was no file name and extension. could you tell me why the url http://localhost/MathService/Ep1 look like this ?

    End points are virtual.  Did by chance try the example? Maybe create a test app?  Anything?

    sudip_inn

    service endpoint url suppose to look like

    http://localhost/MyService/ClassName.svc

    where file name and extension should be there.

    Your'e making assumptions about the technology again.  I suggest that you spend some time reading and experimenting otherwise you'll just ask the same question is a few months.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, November 30, 2016 12:01 PM
  • User753101303 posted

    Hi,

    Yes you could disable WSDL generation. See http://stackoverflow.com/questions/6481180/how-to-hide-wsdl-information-on-wcf

    You can send the WSDL as a file to just the selected partners (keep in mind though this is not a "real" protection measure, it just makes much harder to discover or spy what the service is doing).

    I've seen some creating dynamically a proxy from a WSDL document but I see little reason (anyway you need to know how to consume this service then). Possible reasons I see would be :

    - either you know they have all a particular method and you are interested only in this one and you want to change the service on the fly
    - or maybe a site that would allow to point to a service on a the fly and test it etc....
    - or maybe just you thought it was needed (because the address is not the same or whatever and you think the generated service is tied to the WSDL location) when actually it is not


    Generally I just don't bother. I'm generating a proxy from the WSDL and if one day I find a compelling reason for doing this dynamically if ever I'll do that... Maybe you'll just never run into a situation where you require that.

    Try to understand the basic stuff. Then do what makes sense depending on the current situation.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, November 30, 2016 2:23 PM
  • User753101303 posted

    You could just email them the WSDL file (that you'll save on disk before disabling WSDL generation).

    Else explain the situation. It seems this whole "creating dynamically a proxy" meant for you to create a proxy without a WSDL file (to me it mean having your app creating and consuming a proxy from a WSDL document at runtime rather than at design time).

    Plus it seems now you are just interested in letting someone else to create a proxy if the WSDL generation file is disabled in which case sending the WSDL to them by mail or whatever seems the easier path and they will use the WSDL file as usual. No need for a "channel factory" or whatever.

    This is why I sometimes ask you about your goal. It's easier for us to guide you if we understand your goal rather than answering questions without knowing what you are trying to do especially if you start by asking question about what you think could solve your problem but that might not be the easiest or even not a valid path.

    If sending a WSDL by mail doesn't solve your issue I would suggest to open a new thread and explain what you are trying to do (at this step my understanding is that you want disabled WSDL generation on your service but want to let selected people to create proxy classes to access your service ???)

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, December 3, 2016 11:31 PM

All replies

  • User475983607 posted

    most of the time web service company provide wsdl or endpoint address url as a result client can create proxy but tell me few situation when web service company do not like to provide wsdl or endpoint address url to client to create proxy.

    please tell me few scenario where user has to create proxy dynamically? thanks

    You've asked similar questions over the last several months.  

    A proxy is code generated by Visual Studio when creating a web reference.  Essentially VS is parsing a WSDL.  If the WSDL is not available then you can't very well create a proxy. Similarly, if there is no endpoint then there is no way to communicate with the service as an endpoint is one of the three things needed to communicate with a WCF service.

    I strongly suggest that you take the time necessary to learn the technology rather than post leading questions that have no relevance.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, November 28, 2016 2:11 PM
  • User264732274 posted

    thanks for your suggestion.

    suppose when developer working with VS if they do not have wsdl or endpoint address then how they can create proxy dynamically for web service ?

    at least developer should have some thing to create proxy dynamically for web service . so tell me what developer must have to create proxy dynamically for web service to call. thanks

    Tuesday, November 29, 2016 11:24 AM
  • User475983607 posted

    sudip_inn

    suppose when developer working with VS if they do not have wsdl or endpoint address then how they can create proxy dynamically for web service ?

    Asking the question twice will not change the response.  If the WSDL does not exist then it is not possible to create a proxy.  If the endpoint does not exist you can't access the service.

    sudip_inn

    at least developer should have some thing to create proxy dynamically for web service . so tell me what developer must have to create proxy dynamically for web service to call. thanks

    Incorrect!  The  WSDL (Web Services Description Language) is what's used to create a proxy.  That's what a WSDL is for... there is no super secrete method for creating a proxy. 

    Otherwise a developer needs the service source code and service contracts.  Hopefully the service is on the same platform as the developers platform.  From there the developer would NOT create a proxy!  The developer would programmatically invoke the WCF interface using a channel factory - assuming .NET.

    https://msdn.microsoft.com/en-us/library/ms734681(v=vs.110).aspx

    Again, you need to start reading documentation so you can ask relevant questions. I have referred you to many WCF references and it seems that you have not taken the time to learn because you keep asking the same questions every few months.  This is a support forum for folks that want to learn and move forward.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, November 29, 2016 12:32 PM
  • User264732274 posted

    what developer need to know to create proxy dynamically by channel factory ? endpoint address ?

    Tuesday, November 29, 2016 1:21 PM
  • User475983607 posted

    what developer need to know to create proxy dynamically by channel factory ?

    A WSDL...

    endpoint address ?

    The developer would need read the support docs that come with the service or ask someone what the URL is.

    Tuesday, November 29, 2016 2:47 PM
  • User264732274 posted

    if i have the wsdl or if i know the service url then i can add as web reference from VS IDE and VS will create proxy for me then why we need to create proxy at run time with channel factory?

    your last answer was very short not clear. can make it proper. thanks

    Tuesday, November 29, 2016 7:42 PM
  • User475983607 posted

    if i have the wsdl or if i know the service url then i can add as web reference from VS IDE and VS will create proxy for me then why we need to create proxy at run time with channel factory?

    The whole purpose of a WSDL is to provide the client with the necessary information to communicate with the service.  The rest of your question is literally nonsense.  I never stated  a channel factory is used to create a proxy - you did! 

    your last answer was very short not clear. can make it proper. thanks

    I answer your question properly 4 times.  Maybe it is time for you to read the docs...

    Tuesday, November 29, 2016 9:30 PM
  • User264732274 posted

    just checked this link https://msdn.microsoft.com/en-us/library/ms734681(v=vs.110).aspx you provided. 

    Use the ServiceModel Metadata Utility Tool (Svcutil.exe) to generate the contract (interface) for the client.

    there i saw they told us to use Svcutil.exe

    SvcUtil will generate a proxy class and a configuration file which will specify things such as the bindings the service uses, 
    security credentials, read quotas, the address of the service, the contract etc. SvcUtil will generate the metatadata,
    serialization code and so on. You run SvcUtil on the service machine and the two files it gives you
    (proxy class and configuration file) may be used to create clients on different machines.

    when using channel factory then why we need to use SvcUtil ? can u plzz tell me the reason if u know.

    see this endpoint address EndpointAddress myEndpoint = new EndpointAddress("http://localhost/MathService/Ep1");

    endpoint url looks different there was no file name and extension. could you tell me why the url http://localhost/MathService/Ep1 look like this ?

    service endpoint url suppose to look like

    http://localhost/MyService/ClassName.svc

    where file name and extension should be there.

    this way we can generate c# proxy class and config file using svcutil

    svcutil http://localhost/MyService/ClassName.svc /Language=c#
    /t:Code /out:ClassNameProxy.cs /config:ClassNameProxy.config

    above code taken from http://stackoverflow.com/a/39259530/728750

    http://stackoverflow.com/a/8785460/728750

    please guide me. thanks

    Wednesday, November 30, 2016 11:31 AM
  • User475983607 posted

    sudip_inn

    when using channel factory then why we need to use SvcUtil ? can u plzz tell me the reason if u know.

    For the third time, you don't need to use the Svcutil if you have the source code.  If you don't have the source code then you need the WSDL.  If don't have the source code or the WSDL then you can't communicate with the service.

    I use a channel factory without a proxy for internal WCF messaging all the time.  There is no need to create a proxy if the WCF service is not exposed to the public.

    https://www.codeproject.com/tips/558163/difference-between-proxy-and-channel-factory-in-wc

    sudip_inn

    see this endpoint address EndpointAddress myEndpoint = new EndpointAddress("http://localhost/MathService/Ep1");

    endpoint url looks different there was no file name and extension. could you tell me why the url http://localhost/MathService/Ep1 look like this ?

    End points are virtual.  Did by chance try the example? Maybe create a test app?  Anything?

    sudip_inn

    service endpoint url suppose to look like

    http://localhost/MyService/ClassName.svc

    where file name and extension should be there.

    Your'e making assumptions about the technology again.  I suggest that you spend some time reading and experimenting otherwise you'll just ask the same question is a few months.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, November 30, 2016 12:01 PM
  • User264732274 posted

    1) suppose my web service is hosted in public server which is exposed in internet but i want no body will be able to create proxy for my web service. then tell me how to disable proxy creation ? only my trusted client can call my web service by the channel factory whom i will supply service address and contact file.

    2) when i create a test wcf service in my case service endpoint address was having file name and extension http://localhost/MyService/ClassName.svc

    should i choose wcf service library template which create dll instead of svc file ?

    thanks

    Wednesday, November 30, 2016 12:29 PM
  • User475983607 posted

    1) suppose my web service is hosted in public server which is exposed in internet but i want no body will be able to create proxy for my web service. then tell me how to disable proxy creation ? only my trusted client can call my web service by the channel factory whom i will supply service address and contact file.

    Then  write a working library and provide it to your customers.  Don't forget that not everyone uses .NET so you'll need to craft several binaries to support your customer's different platforms.  

    Why don't you place the WSDL behind a secured login.  Or provide the WSDL (and Cert) on request.

    Why are you reinventing the wheel rather than using the technology as designed?  I posted the WCF Security Guidance many times now. Have you considered reading the doc and finding a solution that fits your needs?

    https://msdn.microsoft.com/en-us/library/ff648370.aspx

    2) when i create a test wcf service in my case service endpoint address was having file name and extension
    http://localhost/MyService/ClassName.svc
    should i choose wcf service library template which create dll instead of svc file ?

    I'm not sure why you would do this unless you want a self-hosted service and I'm not sure what this has to do with anything in this post.  Once again it seems that you are adding your own assumptions to how technology works rather than taking the time to read the docs and understand.

    Wednesday, November 30, 2016 1:24 PM
  • User753101303 posted

    Hi,

    Yes you could disable WSDL generation. See http://stackoverflow.com/questions/6481180/how-to-hide-wsdl-information-on-wcf

    You can send the WSDL as a file to just the selected partners (keep in mind though this is not a "real" protection measure, it just makes much harder to discover or spy what the service is doing).

    I've seen some creating dynamically a proxy from a WSDL document but I see little reason (anyway you need to know how to consume this service then). Possible reasons I see would be :

    - either you know they have all a particular method and you are interested only in this one and you want to change the service on the fly
    - or maybe a site that would allow to point to a service on a the fly and test it etc....
    - or maybe just you thought it was needed (because the address is not the same or whatever and you think the generated service is tied to the WSDL location) when actually it is not


    Generally I just don't bother. I'm generating a proxy from the WSDL and if one day I find a compelling reason for doing this dynamically if ever I'll do that... Maybe you'll just never run into a situation where you require that.

    Try to understand the basic stuff. Then do what makes sense depending on the current situation.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, November 30, 2016 2:23 PM
  • User264732274 posted

    1) you said- Why don't you place the WSDL behind a secured login.  Or provide the WSDL (and Cert) on request.

    can u give me any article link which guide me in details just to say how to place the WSDL behind a secured login. ?

    i want test it in my home pc.

    2) what steps i need to configure at service config file as a result if user try to access my wsdl they will not be able because i like to know how could i disable wsdl. if i have no mex end point.

    see this

    <endpoint address="mex" binding="mexBasicHttpBinding" contract="IMetadataExchange"/>
    
    <serviceMetadata httpGetEnabled="false"/>

    if i remove both from config they end user will be able to create proxy for my service? i guess no. one related post http://stackoverflow.com/a/5870270

    if end user will not be able to create proxy for my web service they how a client call it. i guess i need to pass my contact and client can use channel factory to create proxy on the fly to call service. am i right ?

    please guide me. thanks

    Friday, December 2, 2016 10:36 PM
  • User475983607 posted

    if end user will not be able to create proxy for my web service they how a client call it. i guess i need to pass my contact and client can use channel factory to create proxy on the fly to call service. am i right ?

    No... you're making assumptions and twisting my words to fit your idea of how WCF should work.  

    Unfortunately there is not much I, or anyone, can do to help.  You simply need to set aside the time to learn the basics.   Good luck

    Saturday, December 3, 2016 1:33 AM
  • User264732274 posted
    How to create proxy when it is disable by my trusted client. Show me the way?
    Saturday, December 3, 2016 7:24 AM
  • User753101303 posted

    You could just email them the WSDL file (that you'll save on disk before disabling WSDL generation).

    Else explain the situation. It seems this whole "creating dynamically a proxy" meant for you to create a proxy without a WSDL file (to me it mean having your app creating and consuming a proxy from a WSDL document at runtime rather than at design time).

    Plus it seems now you are just interested in letting someone else to create a proxy if the WSDL generation file is disabled in which case sending the WSDL to them by mail or whatever seems the easier path and they will use the WSDL file as usual. No need for a "channel factory" or whatever.

    This is why I sometimes ask you about your goal. It's easier for us to guide you if we understand your goal rather than answering questions without knowing what you are trying to do especially if you start by asking question about what you think could solve your problem but that might not be the easiest or even not a valid path.

    If sending a WSDL by mail doesn't solve your issue I would suggest to open a new thread and explain what you are trying to do (at this step my understanding is that you want disabled WSDL generation on your service but want to let selected people to create proxy classes to access your service ???)

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, December 3, 2016 11:31 PM