Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Changing schemaLocation in WSDL

Posted on 2016-10-10
9
Medium Priority
?
116 Views
Last Modified: 2016-10-16
I have a WCF Service which I need to host on an old IIS 6 server. The server has a name Server1 but also has an alias used for the website. Apparently the server and the website resolve to different IP addresses.

So WCF Service path is

https://alias.sys.domain.com/ProjectName/MyService.svc?wsdl

Open in new window


But when I look at xml generates, the schemaLocation shows up as:

    <wsdl:types>
      <xsd:schema targetNamespace="http://tempuri.org/Imports">
         <xsd:import schemaLocation="https://server1.subdomain.domain.com/ProjectName/MyService.svc?xsd=xsd0" namespace="http://tempuri.org/" /> 
         <xsd:import schemaLocation="https://server1.subdomain.domain.com/ProjectName/MyService.svc?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/ProjectName" /> 
         <xsd:import schemaLocation="https://server1.subdomain.domain.com/ProjectName/MyService.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/" /> 
       </xsd:schema>
    </wsdl:types>

Open in new window


If I try accessing the schema specified in the xml

https://server1.subdomain.domain.com/ProjectName/MyService.svc?xsd=xsd0

Open in new window




I get "Page cannot be displayed" error, and if I use Network tab in Chrome debug tools, it shows the call has been aborted. But if I try accessing the schema at

https://alias.sys.domain.com/ProjectName/MyService.svc?xsd=xsd0

Open in new window



Then I can get to it without a problem but, unfortunately this is not the one used by the service.

To change that I added httpsGetURL in my config file:

<serviceMetadata httpGetEnabled="true" httpsGetUrl="https://alias.sys.domain.com/ProjectName/MyService.svc"  />

Open in new window


that caused error: "A registration already exists for URI"

which I was able to get rid of by adding "/mex" after ".svc". The strange thing is that I do not have mex endpoint since I cannot use it due to disabled anonymous authentication.

But adding "/mex" caused another error "The message with To 'https://alias.sys.domain.com/ProjectName/MyService.svc/mex?wsdl'
cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher.
Check that the sender and receiver's EndpointAddresses agree."

So then I added address to my endpoint, changing it from

<endpoint address="" binding="webHttpBinding" bindingConfiguration="webBinding" contract="Projectname.IMyService"/>

Open in new window


to

<endpoint address="web1" binding="webHttpBinding" bindingConfiguration="webBinding" contract="Projectname.IMyService"/>

Open in new window


and tried using

https://alias.sys.domain.com/ProjectName/MyService.svc/web1

Open in new window


that changed my error to

The message with Action '' cannot be processed at the receiver, due to a ContractFilter 
mismatch at the EndpointDispatcher. This may be because of either a contract mismatch 
(mismatched Actions between sender and receiver) or a binding/security mismatch between 
the sender and the receiver. Check that sender and receiver have the same contract and 
the same binding (including security requirements, e.g. Message, Transport, None)

Open in new window



Can anyone help?
0
Comment
Question by:YZlat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
9 Comments
 
LVL 16

Expert Comment

by:theo kouwenhoven
ID: 41837999
Hi YZlat,

The space name isn't that important within the WSDL.
Just Install SoapUI (free soap test suit) and create there a Project for your WSDL.

Then you can see in detail what the WSDL is exactly doing
0
 
LVL 35

Expert Comment

by:ste5an
ID: 41838006
The schemaLocation is determined by your endpoint configuration. But as you're using WebHttpBinding in your config, you're working with a RESTful web service. In this case the WSDL has no meaning, cause it is only for SOAP web services.
0
 
LVL 35

Author Comment

by:YZlat
ID: 41838333
@theo kouwenhoven, the problem is not that it is important or unimportant, I was trying to add a service reference to this service from Visual studio and it failed due to invalid value in schemaLocation.

I tried calling it from SOAP UI, created a new project but it failed loading with error:

Error loading 'https://alias.sys.domain.com/ProjectName/MyService.svc?wsdl' org.apache.xmlbeans.XmlException: does not close tag

Open in new window

0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
LVL 35

Author Comment

by:YZlat
ID: 41838336
@ste5an, should I use basicHttpBinding instead?
0
 
LVL 35

Expert Comment

by:ste5an
ID: 41838358
When it is a RESTful service, then you don't use a WSDL and you don't use the Add service reference menu in VS. You simply use HttpClient or WebClient to send post or get requests to it.

But just to be sure, what your problem is:

You said WCF service, do you mean a SOAP or a RESTful web service?
Have you checked the compatibility of your WCF services used target framework and IIS6? I'm not sure that IIS6 can handle the new ones.
Why do you think the alias is a problem?
How have you configured the alias? And how the web service?
0
 
LVL 35

Author Comment

by:YZlat
ID: 41838415
SOAP.


The server is an old Windows 2003 server, the server and web site have different IP addresses. I did not setup the server and all I know is that the service url is:

https://alias.sys.domain.com/ProjectName/MyService.svc

and

somehow https://servername.subdomain.domain.com/ProjectName/MyService.svc somehow get into the xml produced by wsdl
0
 
LVL 35

Expert Comment

by:ste5an
ID: 41838431
Then the problem is the setup. Your service must run separated from your web site. I guess they share currently the same root.
0
 
LVL 35

Accepted Solution

by:
YZlat earned 0 total points
ID: 41838623
Solved the issue by changing

    <services>
      <service behaviorConfiguration="basicBehavior" name="ProjectName.MyService">
         <endpoint address="" binding="webHttpBinding" bindingConfiguration="webBinding" contract="Projectname.IMyService"/>
    
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="basicBehavior">
          <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
      
        </behavior>
      </serviceBehaviors>
    </behaviors>

Open in new window


to

    <services>
      <service behaviorConfiguration="basicBehavior" name="ProjectName.MyService">
         <endpoint address="https://alias.sys.domain.com/ProjectName/MyService.svc" binding="webHttpBinding" bindingConfiguration="webBinding" contract="Projectname.IMyService"/>
    
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="basicBehavior">
          <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" httpsGetUrl="https://alias.sys.domain.com/ProjectName/MyService.svc/ssl"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
      
        </behavior>
      </serviceBehaviors>
    </behaviors>

Open in new window

0
 
LVL 35

Author Closing Comment

by:YZlat
ID: 41845526
solved it myself
0

Featured Post

How To Install Bash on Windows 10

Windows’ budding partnership with Canonical has certainly led to some great improvements. One of them being the ability to use Bash on your Windows machine without third party applications! This might be one of the greatest things a cloud engineer in a Windows environment can do!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question