1

Is there a way to make the schema location in my WSDL relative instead of absolute?? I have been searching for a solution to this, Im learning more about Wsdl generation along the way but I haven't found where I can configure this part of my Wsdl (see highlighted).

Partial WSDL Absolute Path vs.

Partial WSDL Relative Path

Im looking hoping to make this a relative path.

I believe there is probably a way to force this in the webconfig, I just haven't been able to find the solution myself online yet. Any help would be great appreciated if this is possible. If it's not possible, I'll accept that as a solution as well. Thanks!

Puerto
  • 1,072
  • 3
  • 11
  • 32
  • first question... why do you want to do that? It is a standard – techspider Jun 15 '16 at 15:39
  • 1
    We have an appliance from IBM we route our traffic through that wants us to use relative pathing. I'm not sure you'd call it standard at this point, but we were asked to use relative paths. The appliance used to set the relative paths, a recent firmware update has stopped this. We are trying to fix the problem from our end at this point. It's kind of a long story. I just need know if this is possible. Thank! – Puerto Jun 15 '16 at 15:43
  • not sure but see if this is something you are trying to achieve http://stackoverflow.com/questions/13154726/how-do-you-share-wcf-wsdl-and-xsds-to-a-client-without-access-to-the-service-y – techspider Jun 15 '16 at 15:53
  • In the answer it simply suggest this, "Update your wsdl with the new xsd relative path.. just replace the entire link for xsd by its name." We this is the point where Im just not sure how this is done and I don't see that mentioned in the article. Am I missing something obvious on how you would updated the path. I've already tried updating my endpoint address with a relative path, ie "endpoint address="Service1.svc". it still comes out as absolute path like http://localhost:52038/Service1.svc?xsd=xsd0 with that as my endpoint address. – Puerto Jun 15 '16 at 17:41
  • it may worth adding your answer yourself and giving that link as reference – techspider Jun 15 '16 at 17:42
  • If I find an answer myself I'll definitely add it and list any references. I always do. I try not to leave things undone here. – Puerto Jun 15 '16 at 17:46

1 Answers1

2

Sorry for the late return on this. I was pulled aside for a few other issues. So for my solution I had to create my own WSDL and save it locally. Basically you can start with the WebService generated one, and just save it off as .WSDL file. Edit how you need too. If you need relative paths like I did, I simply added the relative paths and saved it in the root of the webservice application. It went from this:

using the standard link http://localhost:52038/Service1.svc?wsdl
-<xsd:schema targetNamespace="http://tempuri.org/Imports">

   <xsd:import namespace="http://tempuri.org/"schemaLocation="http://localhost:52038/Service1.svc?xsd=xsd0"/>

   <xsd:import namespace="http://schemas.microsoft.com/2003/10/Serialization/" schemaLocation="http://localhost:52038/Service1.svc?xsd=xsd1"/>

</xsd:schema> 

To a local WSDL I save and changed the schemaLocations to relative paths like so:

-<xsd:schema targetNamespace="http://tempuri.org/Imports">

   <xsd:import namespace="http://tempuri.org/" schemaLocation="xsd0.xsd"/>

   <xsd:import namespace="http://schemas.microsoft.com/2003/10/Serialization/" schemaLocation="xsd1.xsd"/>

</xsd:schema>

Then I disabled the serviceMetaData 'httpGetEnabled=False' in web.config, so the WebService would no longer generate the WSDL. If I was to give this WSDL out now to consumers I would give them the path to my custom local WSDL http://localhost:52038/Service1.wsdl

I'm sure there is more that could be said regarding this subject but I wanted to share what I did here. Disclaimer, this is just sample project regarding a general POC for something. Thank you!

Puerto
  • 1,072
  • 3
  • 11
  • 32