Click here to Skip to main content
15,885,365 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello,

I am trying to change the namespace of the following which is the default namespace -- i believe , generated by WCF. Primary reason is client will generate proxy to use and consume the service and they are using a tool to auto generate it, but the word (schema/s) are in conflict with it. Application that will consume is in Java. :

XML
<xsd:import schemaLocation="http://localhost:8733/Design_Time_Addresses/StowageBankListOOG/StowageService/?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>


First, i am trying it locally but to no avail. The method that I have tried

(as suggested on the following link: https://social.msdn.microsoft.com/Forums/en-US/c3854509-c12e-4b2e-a91f-ca84d237c78d/is-it-possible-to-change-the-httpschemasmicrosoftcom200310serialization-in-wcf-wsdl?forum=wcf)

is to create a new xsd that contains the same content generated by default by WCF but with a different namespace:

From:

XML
targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/"


To:

XML
targetNamespace="http://StowageOOGList.oocl.com/StowageBankListOOG/Serialization/"



The second step is to create a new WSDL but again with the same content of the default one but altering the schema location and the namespace:

From:

XML
<xsd:import schemaLocation="http://localhost:8733/Design_Time_Addresses/StowageBankListOOG/StowageService/?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>


To:

XML
<xsd:import schemaLocation="http://localhost:8733/StowageSchema.xsd" namespace="http://StowageOOGList.oocl.com/StowageBankListOOG/Serialization/"/>


Then the last step is in the app config is to add the externalMetadataLocation:

XML
<behavior name="StowageSvcBehavior">
   <serviceMetadata httpGetEnabled="true" externalMetadataLocation="http://localhost:8733/StowageServiceWSDL.wsdl"/>



But this gives me error as below:

Error: Cannot obtain Metadata from http://localhost:8733/Design_Time_Addresses/StowageBankListOOG/StowageService/GetList/mex If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error URI: http://localhost:8733/Design_Time_Addresses/StowageBankListOOG/StowageService/GetList/mex Metadata contains a reference that cannot be resolved: 'http://localhost:8733/StowageServiceWSDL.wsdl'. The remote server returned an error: (404) Not Found.HTTP GET Error URI: http://localhost:8733/Design_Time_Addresses/StowageBankListOOG/StowageService/GetList/mex There was an error downloading 'http://localhost:8733/Design_Time_Addresses/StowageBankListOOG/StowageService/GetList/mex'. The request failed with HTTP status 400: Bad Request.

Appreciate if anyone can help why i get the error above? Should the custom built xsd and wsdl be together with the bin folder? i tried but to no avail, also on root folder.

Below is the whole appconfig file:

XML
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  
<!-- For service diagnostics you may uncomment below to trace root problem
  <system.diagnostics>
    <sources>
      <source name="System.ServiceModel" switchValue="Information, ActivityTracing" propagateActivity="true">
        <listeners>
          <add name="traceListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData="c:\log\Traces.svclog" />
        </listeners>
      </source>
    </sources>
  </system.diagnostics>
-->
  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" compilerOptions="/warnaserror-" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
        <providerOption name="CompilerVersion" value="v3.5"/>
      </compiler>
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" compilerOptions="/optioninfer+ /optionstrict+" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
        <providerOption name="CompilerVersion" value="v3.5"/>
      </compiler>
    </compilers>
  </system.codedom>
  
  <connectionStrings>
    <add name="ConnString" connectionString="Data Source=testsource; initial catalog=test; user id=user; password=user"/>
  </connectionStrings>
  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
  </appSettings>
  <system.web>
    <compilation debug="true"/>
  </system.web>

  <!-- When deploying the service library project, the content of the config file must be added to the host's 
  app.config file. System.Configuration does not support config files for libraries. -->
  <system.serviceModel>
    <bindings>
      <webHttpBinding>
        <binding name="HttpBufferSize" maxBufferPoolSize ="2500000" maxReceivedMessageSize="2500000" maxBufferSize="2500000">
          <readerQuotas maxArrayLength="656000" maxBytesPerRead="656000" maxDepth="32" maxNameTableCharCount="656000" maxStringContentLength="656000"/>
        </binding>
      </webHttpBinding>
    </bindings>
    <services>
      <service behaviorConfiguration="StowageSvcBehavior" name="StowageBankListOOG.StowageService">
        <endpoint address="GetList" behaviorConfiguration="StowageSvcWebBehavior" binding="webHttpBinding" bindingConfiguration="HttpBufferSize" name="StowageEndPoint" contract="StowageBankListOOG.IStowageService">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <endpoint address="GetList/mex" binding="mexHttpBinding" name="StowageMetaEndPoint" contract="IMetadataExchange"/>
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8733/Design_Time_Addresses/StowageBankListOOG/StowageService/"/>
          </baseAddresses>
        </host>
      </service>
    </services>
    <behaviors>
      <endpointBehaviors>
        <behavior name="StowageSvcWebBehavior">
          <webHttp/>
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="StowageSvcBehavior">
          <serviceMetadata httpGetEnabled="true" externalMetadataLocation="http://localhost:8733/StowageServiceWSDL.wsdl"/>
          <serviceDebug includeExceptionDetailInFaults="true" />
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="true"/>
  </system.webServer>
</configuration>



Appreciate the help. Kinda stuck in this for about a day now. I just learned about WCF so my knowledge about is just quite fresh. Thanks. Have kinda posted and asked in other forums but i still haven't received any replies and i am on a tight schedule.

Thanks,
Eigh
Posted
Updated 26-Jan-16 21:09pm
v3
Comments
Kornfeld Eliyahu Peter 27-Jan-16 2:05am    
From all this mess the one thing not clear to me is WHY?! Why to change that?!
Do you understand what the meaning of all those namespaces here?
Member 12243951 27-Jan-16 3:00am    
Client wants it to be changed to (company.com/...) instead of using the word - schemas - its the tool that they are using that has conflict with the namespace starting with (schemas) .. so appreciate to know if this is changeable or not and how perhaps.. they are trying to consume the service and will need to generate proxy but again it has conflict with the namespaces -- client will be using Java
Member 12243951 27-Jan-16 3:02am    
I will appreciate also to know why it is not recommended to change this particular namespace if you would suggest it not to do so
NightWizzard 27-Jan-16 13:17pm    
Maybe localhost is the problem? I would prefer to set the corect url of the server where the service is executed and the schema is located.
Member 12243951 31-Jan-16 20:51pm    
I tried but still the same.. i am thinking to exclude it as the second option.. any suggestion?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900