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. :
<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:
targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/"
To:
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:
<xsd:import schemaLocation="http://localhost:8733/Design_Time_Addresses/StowageBankListOOG/StowageService/?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
To:
<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:
<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:
="1.0"="utf-8"
<configuration>
<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>
<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"/>
<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