API Help

Hi
I am using the demo code to attempt to connect to the web services

ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, errors) => { return true; };
EndpointBindingType bindingType = EndpointBindingType.SOAPHttp;
string epicorUserID = “********”; << my epicor login
string epiorUserPassword = “****”; << my password

        string scheme = "http"; 
        if (bindingType == EndpointBindingType.BasicHttp)
        {
            scheme = "https";
        }

     
        UriBuilder builder = new UriBuilder(scheme, "e10server3.internal.labs.com");
    // http:///EpicorERPTest/Ice/Lib/SessionMod.svc
        // change 'ERP100500' to the name of your appserver
        builder.Path = "EpicorERPTest/Ice/Lib/SessionMod.svc";
        SessionModSvcContractClient sessionModClient = GetClient<SessionModSvcContractClient, SessionModSvcContract>(
            builder.Uri.ToString(),
            epicorUserID,
            epiorUserPassword,
            bindingType);

        // change 'ERP100500' to the name of your appserver
        builder.Path = "EpicorERPTest/Erp/BO/AbcCode.svc";
        ABCCodeSvcContractClient abcCodeClient = GetClient<ABCCodeSvcContractClient, ABCCodeSvcContract>(
            builder.Uri.ToString(),
            epicorUserID,
            epiorUserPassword,
            bindingType);
        Guid sessionId = Guid.Empty;
        sessionId = sessionModClient.Login();

All works until i call the login method and i get the following error
System.ServiceModel.EndpointNotFoundException: ‘There was no endpoint listening at http://e10server3.internal.labs.com/EpicorERPTest/Ice/Lib/SessionMod.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.’

if i have checked the url and all seems to be ok
Any pointers please this is driving me insane

Do you have
<add scheme="http" binding="wsHttpBinding" bindingConfiguration="SOAPHttp" />
in your web.config protocolMapping?

1 Like

Hi
No this has not help still getting the same error any help would be very much appreciated
Regards
Andy

EndpointNotFoundException: There was no endpoint listening at http://e10server3.internal.labs.com/EpicorERPTest/Ice/Lib/SessionMod.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.]
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +159
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) +353

Hi
Using the SvcUtil.exe tool i get the following

Access to the path ‘C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\SessionModSvcFacade.cs’ is denied.

Your URI doesn’t look quite right, try:

UriBuilder builder = new UriBuilder(scheme, "e10server3");

Also, you can browse to endpoint or wsdl. You can use this to verify your URL:

Hi
Thanks for the response, it seems the server address is good as you can see the, i have tried everything so any help would be appreciated

This is the section of my web config

<system.serviceModel>
	<protocolMapping>
		<remove scheme="net.tcp" />
		<!--<add scheme="net.tcp" binding="customBinding" bindingConfiguration="TcpCompressedWindows" />-->
		<!--<add scheme="net.tcp" binding="customBinding" bindingConfiguration="TcpCompressedUsernameSslChannel" />-->
		<add scheme="net.tcp" binding="customBinding" bindingConfiguration="TcpCompressedUsernameWindowsChannel" />
		<!--
  <remove scheme="http" />
  <add scheme="http" binding="wsHttpBinding" bindingConfiguration="SOAPHttp" />
  <add scheme="http" binding="customBinding" bindingConfiguration="HttpBinaryUsernameSslChannel" />
  
  <add scheme="http" binding="customBinding" bindingConfiguration="HttpsOffloadBinaryUserNameChannel" />
  <add scheme="http" binding="customBinding" bindingConfiguration="HttpsOffloadBinaryAzureChannel" />
  -->
		<!--
  <remove scheme="https" />
  <add scheme="https" binding="customBinding" bindingConfiguration="HttpsBinaryUsernameChannel"/>
  <add scheme="https" binding="customBinding" bindingConfiguration="HttpsBinaryAzureChannel"/>
  <add scheme="https" binding="customBinding" bindingConfiguration="HttpsBinaryWindowsChannel"/>
  <add scheme="https" binding="basicHttpBinding" bindingConfiguration="BasicHttp" />
  -->
		<remove scheme="https" />
		<add scheme="https" binding="basicHttpBinding" bindingConfiguration="BasicHttp" />
		<remove scheme="http" />
		<add scheme="http" binding="wsHttpBinding" bindingConfiguration="SOAPHttp" />
		<remove scheme="http" />
		<remove scheme="https" />
	</protocolMapping>
	<services>
		<service name="Epicor.Web.TokenResource">
			<endpoint address="" behaviorConfiguration="webBehavior" binding="webHttpBinding" bindingConfiguration="RestHttps" contract="Epicor.Web.TokenResource" />
		</service>
		<service name="Erp.Services.Web.ECC">
			<endpoint address="" behaviorConfiguration="webBehavior" binding="webHttpBinding" bindingConfiguration="RestHttps" contract="Erp.Services.Web.ECC" />
		</service>
	</services>
	<bindings>
		<!--REST/OData - Authentication: Epicor Username - Channel encrypted via https  -->
		<webHttpBinding>
			<binding name="RestHttps" transferMode="Buffered">
				<security mode="Transport">
					<transport clientCredentialType="InheritedFromHost" />
				</security>
				<readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="2147483647" maxStringContentLength="2147483647" />
			</binding>
		</webHttpBinding>
		<!--SOAP 1.1 - Authentication: Epicor Username - Channel encrypted via https -->
		<basicHttpBinding>
			<binding name="BasicHttp" maxReceivedMessageSize="2147483647">
				<security mode="TransportWithMessageCredential">
					<message clientCredentialType="UserName" />
				</security>
				<readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="2147483647" maxStringContentLength="2147483647" />
			</binding>
		</basicHttpBinding>
		<!--SOAP 1.2 - Authentication: Epicor Username - Message encrypted -->
		<wsHttpBinding>
			<binding name="SOAPHttp" maxReceivedMessageSize="2147483647">
				<security mode="Message">
					<message clientCredentialType="UserName" />
				</security>
				<readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="2147483647" maxStringContentLength="2147483647" />
			</binding>
		</wsHttpBinding>
		<customBinding>
			<!--HTTPS - Authentication: Epicor Username - Channel encrypted via https -->
			<binding name="HttpsBinaryUsernameChannel" openTimeout="00:10:00" receiveTimeout="9:00:00" sendTimeout="9:00:00">
				<binaryMessageEncoding compressionFormat="Deflate">
					<readerQuotas maxDepth="50" maxArrayLength="2147483647" maxBytesPerRead="2147483647" />
				</binaryMessageEncoding>
				<security authenticationMode="UserNameOverTransport" />
				<httpsTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
			</binding>
			<!--HTTPS - Authentication: Windows credentials - Channel encrypted via https -->
			<binding name="HttpsBinaryWindowsChannel" openTimeout="00:10:00" receiveTimeout="9:00:00" sendTimeout="9:00:00">
				<binaryMessageEncoding compressionFormat="Deflate">
					<readerQuotas maxDepth="50" maxArrayLength="2147483647" maxBytesPerRead="2147483647" />
				</binaryMessageEncoding>
				<security authenticationMode="SspiNegotiatedOverTransport" requireSecurityContextCancellation="False" />
				<httpsTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
			</binding>
			<!--HTTPS - Authentication: Azure AD token - Channel encrypted via https -->
			<binding name="HttpsBinaryAzureChannel" openTimeout="00:10:00" receiveTimeout="9:00:00" sendTimeout="9:00:00">
				<binaryMessageEncoding compressionFormat="Deflate">
					<readerQuotas maxDepth="50" maxArrayLength="2147483647" maxBytesPerRead="2147483647" />
				</binaryMessageEncoding>
				<httpsTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
			</binding>
			<!--HTTP - Authentication: Epicor Username - Channel not encypted - SOAP SSL message security is used-->
			<binding name="HttpBinaryUsernameSslChannel" openTimeout="00:10:00" receiveTimeout="9:00:00" sendTimeout="9:00:00">
				<binaryMessageEncoding compressionFormat="Deflate">
					<readerQuotas maxDepth="50" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxStringContentLength="2147483647" />
				</binaryMessageEncoding>
				<security authenticationMode="UserNameForSslNegotiated" requireSecurityContextCancellation="False" />
				<httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
			</binding>
			<!--HTTP - Authentication: Epicor Username - Channel not encypted - SSL Offloading must be done on proxy-->
			<binding name="HttpsOffloadBinaryUserNameChannel" openTimeout="00:10:00" receiveTimeout="9:00:00" sendTimeout="9:00:00">
				<binaryMessageEncoding compressionFormat="Deflate">
					<readerQuotas maxDepth="50" maxArrayLength="2147483647" maxBytesPerRead="2147483647" />
				</binaryMessageEncoding>
				<security authenticationMode="UserNameOverTransport" allowInsecureTransport="True" />
				<httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
			</binding>
			<!--HTTP - Authentication: Azure AD token - Channel not encypted - SSL Offloading must be done on proxy-->
			<binding name="HttpsOffloadBinaryAzureChannel" openTimeout="00:10:00" receiveTimeout="9:00:00" sendTimeout="9:00:00">
				<binaryMessageEncoding compressionFormat="Deflate">
					<readerQuotas maxDepth="50" maxArrayLength="2147483647" maxBytesPerRead="2147483647" />
				</binaryMessageEncoding>
				<httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
			</binding>
			<!--NET.TCP - Authentication: Epicor Username - Channel encrypted via SSL -->
			<binding name="TcpCompressedUsernameSslChannel" openTimeout="00:10:00" receiveTimeout="9:00:00" sendTimeout="9:00:00">
				<CompressionEncoder>
					<binaryMessageEncoding>
						<readerQuotas maxDepth="50" maxArrayLength="2147483647" maxBytesPerRead="2147483647" />
					</binaryMessageEncoding>
				</CompressionEncoder>
				<security authenticationMode="UserNameOverTransport" />
				<sslStreamSecurity />
				<tcpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" transferMode="Buffered" />
			</binding>
			<!--NET.TCP - Authentication: Windows Credentials - Channel encrypted via Windows Trusted Domain between Client and Server -->
			<binding name="TcpCompressedWindows" openTimeout="00:10:00" receiveTimeout="9:00:00" sendTimeout="9:00:00">
				<CompressionEncoder>
					<binaryMessageEncoding>
						<readerQuotas maxDepth="50" maxArrayLength="2147483647" maxBytesPerRead="2147483647" />
					</binaryMessageEncoding>
				</CompressionEncoder>
				<windowsStreamSecurity />
				<tcpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" transferMode="Buffered" />
			</binding>
			<!--NET.TCP - Authentication: Epicor Username - Channel encrypted via Windows Trusted Domain between Client and Server -->
			<binding name="TcpCompressedUsernameWindowsChannel" openTimeout="00:10:00" receiveTimeout="9:00:00" sendTimeout="9:00:00">
				<CompressionEncoder>
					<binaryMessageEncoding>
						<readerQuotas maxDepth="50" maxArrayLength="2147483647" maxBytesPerRead="2147483647" />
					</binaryMessageEncoding>
				</CompressionEncoder>
				<security authenticationMode="UserNameOverTransport" />
				<windowsStreamSecurity />
				<tcpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" transferMode="Buffered" />
			</binding>
		</customBinding>
	</bindings>
	<extensions>
		<bindingElementExtensions>
			<add name="CompressionEncoder" type="Epicor.ServiceModel.Configuration.CompressionEncodingElement, Epicor.ServiceModel, Culture=neutral" />
		</bindingElementExtensions>
		<behaviorExtensions>
			<add name="AddressFilterModeAny" type="Epicor.Hosting.Wcf.AddressFilterModeAnyElement, Epicor.System, Culture=neutral" />
		</behaviorExtensions>
	</extensions>
	<behaviors>
		<endpointBehaviors>
			<behavior name="webBehavior">
				<webHttp helpEnabled="true" />
			</behavior>
		</endpointBehaviors>
		<serviceBehaviors>
			<behavior>
				<serviceThrottling maxConcurrentCalls="15120" maxConcurrentSessions="500000" maxConcurrentInstances="15120" />
				<serviceDebug includeExceptionDetailInFaults="true" />
				<serviceMetadata httpGetEnabled="true" />
				<serviceSecurityAudit auditLogLocation="Application" serviceAuthorizationAuditLevel="Failure" messageAuthenticationAuditLevel="Failure" suppressAuditFailure="true" />
				<serviceCredentials>
					<!-- Uncomment for Ssl. Set FindType and Value based on your Certificate  -->
					<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Ice.Security.UsernameValidator, Epicor.Ice, Culture=neutral" />
					<clientCertificate>
						<authentication revocationMode="NoCheck" certificateValidationMode="PeerOrChainTrust" />
					</clientCertificate>
					<!--<serviceCertificate x509FindType="FindBySubjectName" findValue="E10SERVER3.internal.labs.com" storeLocation="LocalMachine" storeName="My" />-->
				</serviceCredentials>
				<!--
      Note: This service authorization entry must exist to validate calls destined for ICE or Ice-derived application services.
      -->
				<serviceAuthorization serviceAuthorizationManagerType="Ice.Security.AuthorizationManager, Epicor.Ice, Culture=neutral" />
				<!-- Uncomment this element when AddressFilter mismatch at the EndpointDispatcher happens 
      <AddressFilterModeAny/>-->
			</behavior>
		</serviceBehaviors>
	</behaviors>
</system.serviceModel>

When i create the reference in visual studio i get the following screens

Followed by

Your server’s SSL certificate might be too rigid, does it include an asterisk for subdomains?

If this is for development purposes, you may be able to bypass this by declaring the following in your code prior to making any requests:

if(Development)
ServicePointManager.ServerCertificateValidationCallback += (o, c, ch, er) => true;

Warning: The above code bypasses the client side validation done in your calling code, basically breaking SSL. This should only be used for development.


i will try the above “after Christmas now” i believe it is a cert issue, unfortunately i have only just taken ownership of our new Epicor ERP project and we are still in implementation sprint, so its a bit of a learning curve by very impressed with the functionality of Epicor in the whole week i have been working with it

At the end of the protocol mapping node in your web.config, there is 2 remove tags, one for http and one for https. What happens if you remove those? I checked a working web.config on one of my servers, and mine does not end the protocol mapping node with remove tags.

Hi all
removed the tags from my web config and replaced the code with
if(Development)
ServicePointManager.ServerCertificateValidationCallback += (o, c, ch, er) => true;

and still not working, any more ideas what this could be ???/


I have noticed the endpoints dont seem to be set in the admin console, could this be the issues

Andy

when i remove the following 2 tags

i get the following error
Exception caught in: mscorlib
Error Detail ============ Message:
The requested service, ‘net.tcp://e10server3/EpicorERPTest/Ice/Lib/SessionMod.svc’ could not be activated. See the server’s diagnostic trace logs for more information. Program: CommonLanguageRuntimeLibrary Method:HandleReturnMessage
Client Stack Trace

Looks like a cert issue then.

Get the subject name of your cert, and uncomment the node under serviceBehaviors / behaviors in your web.config .

You might also need to assign the cert to a binding in your IIS site. In IIS, make sure the site has a https binding and that the cert is assigned to that binding.

You might also need to set the cert

After days and days i still could not connect so just made a reference to the dlls direct as so
static void TestUsingPartContract()
{

        var wcfBinding = NetTcp.UsernameWindowsChannel();
        var appServer = new Uri("net.tcp://localhost/EpicorERPTest/ERP/BO/Part.svc");
        using (ChannelFactory<Erp.Contracts.PartSvcContract> cf = new ChannelFactory<Erp.Contracts.PartSvcContract> (wcfBinding))
        {
            cf.Credentials.UserName.UserName = "";
            cf.Credentials.UserName.Password = "";

            var partClient = cf.CreateChannel(new EndpointAddress(appServer));
            bool morePages;
            var myPartTableset = partClient.GetList("", 10, 1, out morePages);

            foreach (var partRec in myPartTableset.PartList)
            {
                MessageBox.Show(partRec.PartNum + "  desc =" + partRec.PartDescription);
            }
            cf.Close();
        }
    }

If this is still the error you have, open event viewer on your server machine and look for exact error. Check application log and epicor app server log. What error is shown there?