Issues generating Enterprise jar for Salesforce Soap API; issue with generated WSDL XML from Salesforce - soap

I've recently made some databasae changes to custom objects, and I'm trying to generate a new enterprise.jar to reflect these changes. I'm following all documentation located here for the process. I'll also note, with the exception of some new dependencies, I've followed this process before with no errors to generate the enterprise.jar file. So this is a process that has worked for my sandbox in the past, but we haven't had any structural changes to the database in a solid 5 years.
Following along with the steps is simple enough. I generate the XML file from my Salesforce login in my developer sandbox utilizing Enterprise WSDL (we clearly have Enterprise level service, just so that's established). From there, I go to the Maven repository, get force-wsc-48.0.0.jar from there (as per the current API version of my sandbox), and then download a few dependencies like rhino, ST, and antlr-runtime. I get all files together in a temp folder in my C drive and try running command:
java -classpath C:\temp\force-wsc-48.0.0.jar;C:\temp\rhino1_7R4\js.jar;C:\temp\ST-4.3.1.jar;\jdk\jdk1.8.0_251\lib\tools.jar;C:\temp\antlr-runtime-3.5.jar com.sforce.ws.tools.wsdlc C:\temp\enterprise.wsdl C:\temp\enterprise.jar
Here's where the trouble begins. Once I run this, I hit the following error:
Exception in thread "main" com.sforce.ws.wsdl.WsdlParseException: Parse error: Found invalid XML. could not determine namespace bound to element prefix xsd (position: TEXT seen ...ration value="ACTIONCALL_DUPLICATE_INPUT_PARAM">\r\n<xsd:annotation>... #17360:17)
at com.sforce.ws.wsdl.WsdlParser.next(WsdlParser.java:94)
at com.sforce.ws.wsdl.Definitions.read(Definitions.java:111)
at com.sforce.ws.wsdl.WsdlFactory.createFromInputStream(WsdlFactory.java:69)
at com.sforce.ws.wsdl.WsdlFactory.create(WsdlFactory.java:49)
at com.sforce.ws.codegen.Generator.generate(Generator.java:94)
at com.sforce.ws.tools.wsdlc.run(wsdlc.java:115)
at com.sforce.ws.tools.wsdlc.run(wsdlc.java:149)
at com.sforce.ws.tools.wsdlc.main(wsdlc.java:71)
Caused by: com.sforce.ws.ConnectionException: Found invalid XML. could not determine namespace bound to element prefix xsd (position: TEXT seen ...ration value="ACTIONCALL_DUPLICATE_INPUT_PARAM">\r\n<xsd:annotation>... #17360:17)
at com.sforce.ws.parser.XmlInputStream.next(XmlInputStream.java:138)
at com.sforce.ws.wsdl.WsdlParser.next(WsdlParser.java:90)
... 7 more
Caused by: com.sforce.ws.parser.XmlPullParserException: could not determine namespace bound to element prefix xsd (position: TEXT seen ...ration value="ACTIONCALL_DUPLICATE_INPUT_PARAM">\r\n<xsd:annotation>... #17360:17)
at com.sforce.ws.parser.MXParser.parseStartTag(MXParser.java:1826)
at com.sforce.ws.parser.MXParser.nextImpl(MXParser.java:1144)
at com.sforce.ws.parser.MXParser.next(MXParser.java:1111)
at com.sforce.ws.parser.XmlInputStream.next(XmlInputStream.java:136)
... 8 more
A snipped of the XML at error line:
<!--
These are the extension code to provide additional error information
-->
<simpleType name="ExtendedErrorCode">
<restriction base="xsd:string">
<enumeration value="ACTIONCALL_DUPLICATE_INPUT_PARAM">
<xsd:annotation>
<xsd:documentation>
Errors with this extended error code have the following properties: severity, actionCallName, parameterName
</xsd:documentation>
</xsd:annotation>
</enumeration>
<enumeration value="ACTIONCALL_DUPLICATE_OUTPUT_PARAM">
<xsd:annotation>
<xsd:documentation>
Errors with this extended error code have the following properties: severity, actionCallName, parameterName
</xsd:documentation>
</xsd:annotation>
</enumeration>
Parent schema:
<schema elementFormDefault="qualified" targetNamespace="urn:fault.enterprise.soap.sforce.com">
<import namespace="urn:enterprise.soap.sforce.com"/>
I don't know if it's necessary, but I'll note that there's no <xsd:schema...> at all in the XML file. xsd is used before this, but only to define element string types; eg: <element name="sessionId" type="xsd:string" nillable="true"/>
If I remove xsd prefix from everything that causes the error, I'll instead get the same error, but for soap instead of xsd. XML snippet of first instance of that:
<!-- Soap Binding -->
<binding name="SoapBinding" type="tns:Soap">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="login">
<soap:operation soapAction=""/>
<input>
<soap:header use="literal" message="tns:Header" part="LoginScopeHeader"/>
<soap:body parts="parameters" use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
There's no parent schema here.
Again, there is no <soap:schema...> defined in the XML. And if I remove all of the instances of using the soap prefix, I'll land on the following issue.
Exception in thread "main" com.sforce.ws.wsdl.WsdlParseException: targetNamespace not specified in wsdl:definitions
at com.sforce.ws.wsdl.Definitions.read(Definitions.java:115)
at com.sforce.ws.wsdl.WsdlFactory.createFromInputStream(WsdlFactory.java:69)
at com.sforce.ws.wsdl.WsdlFactory.create(WsdlFactory.java:49)
at com.sforce.ws.codegen.Generator.generate(Generator.java:94)
at com.sforce.ws.tools.wsdlc.run(wsdlc.java:115)
at com.sforce.ws.tools.wsdlc.run(wsdlc.java:149)
at com.sforce.ws.tools.wsdlc.main(wsdlc.java:71)
Again, not sure if it matters, but there's no <wsdl:definitions...> in the XML file.
I don't know if this is an issue of Salesforce generating a bad XML file (the issue occurs even in sandboxes I haven't made any database changes for, including production where I have an old but working enterprise.jar), if I don't have the right force-wsc jar file, if I'm not running it through the right version of Java (1.8, if it wasn't clear, but I've tried earlier versions of java and I just get the minor.major 52 error, which means it should be 8, as far as I know).
Any help pinpointing what the issue here is would be greatly appreciated. I'm more than open to suggestions. And if it is just Salesforce giving me a bad XML file, I can open a ticket there. I just want to make sure I'm not doing something wrong before I open a ticket.

After spending more time on this, and after coordinating with a co-worker who works on a different Salesforce project, we've discovered the following
1 Salesforce was absolutely giving a bad WSDL file.
2 The generation of the bad WSDL file only occurred because I was using a Firefox web browser. Using Chrome instead to access the WSDL generation fixed the issue, of all things.
So for any poor soul that comes across this issue in the future, I hope using Chrome fixes it for you as well.

Related

mathml xsd schema to java classes using xjc MiOrMoOrMn <jaxb:property> error

Jaxb / xjc won't create java classes from xsd schema file (Eclipse and command line)
Using jre1.8.0_191 and JAXB both Eclipse and xjc command line (and switches) give errors when trying to convert imsqti_v2p1.xsd (learning object quizzes) to POJOs (plain old java objects). Most errors said "Property X is already defined. Use to resolve this conflict" and I was able to annotate imsqti_v2p1.xsd until (in both Eclipse and command line xjc) only one error remains:
parsing a schema...
[ERROR] Property "MiOrMoOrMn" is already defined. Use to
resolve this conflict. line 132 of
http://www.w3.org/Math/XMLSchema/mathml2/presentation/scripts.xsd
Now, imsqti_v2p1.xsd has many xmlns' - the one responsible for the error is
<xs:import namespace="http://www.w3.org/1998/Math/MathML"
schemaLocation="http://www.w3.org/Math/XMLSchema/mathml2/mathml2.xsd"/>
This xsd is SHORT and has many local references, one of which causes the error
I did find this scripts.xsd - the compiler complained about line 132 and Property "MiOrMoOrMn" but scripts.xsd ends at line 130! Plus, when I load scripts.xsd into Eclipse editor it has a dozen errors - if they are caused by missing "neighbor" xsd's referenced by mathml2.xsd I'd probably have to find and download and run locally 27 local xsd's! So I'd hoped I could fix scripts.xsd and refer to it locally in a xmlns in the mathml2.xsd header, but now I'm not sure how to resolve this. Also, If you know of a better way to create these POJO's I'd be hearing about it - someone must know about this mathml xsd issue?!?
==================== imsqti_v2p1.xsd =============================
<xs:schema xmlns:jxb="http://java.sun.com/xml/ns/jaxb" jxb:version="2.1"
xmlns="http://www.imsglobal.org/xsd/imsqti_v2p1"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:m="http://www.w3.org/1998/Math/MathML"
xmlns:apip="http://www.imsglobal.org/xsd/apip/apipv1p0/imsapip_qtiv1p0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:sch="http://purl.oclc.org/dsdl/schematron"
targetNamespace="http://www.imsglobal.org/xsd/imsqti_v2p1" version="IMS
QTI 2.1" elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="http://www.imsglobal.org/xsd/w3/2001/xml.xsd"/>
<xs:import namespace="http://www.w3.org/2001/XInclude"
schemaLocation="http://www.imsglobal.org/xsd/w3/2001/XInclude.xsd"/>
<xs:import namespace="http://www.w3.org/1998/Math/MathML"
schemaLocation="http://www.w3.org/Math/XMLSchema/mathml2/mathml2.xsd"/>
<xs:import
namespace="http://www.imsglobal.org/xsd/apip/apipv1p0/imsapip_qtiv1p0"
schemaLocation="http://www.imsglobal.org/profile/apip/apipv1p0/
apipv1p0_qtiextv2p1_v1p0.xsd"/>
==================== mathml2.xsd ==================
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.w3.org/1998/Math/MathML"
targetNamespace="http://www.w3.org/1998/Math/MathML"
elementFormDefault="qualified">
<xs:include schemaLocation="common/math.xsd"/>
<xs:include schemaLocation="common/common-attribs.xsd"/>
<!-- Presentation -->
<xs:include schemaLocation="presentation/common-types.xsd"/>
<xs:include schemaLocation="presentation/common-attribs.xsd"/>
<xs:include schemaLocation="presentation/characters.xsd"/>
<xs:include schemaLocation="presentation/tokens.xsd"/>
<xs:include schemaLocation="presentation/scripts.xsd"/>
============= scripts.xsd ========================
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.w3.org/1998/Math/MathML"
targetNamespace="http://www.w3.org/1998/Math/MathML"
elementFormDefault="qualified">
================ compiler error message ==================
parsing a schema...
[ERROR] Property "MiOrMoOrMn" is already defined. Use <jaxb:property>
to resolve this conflict. line 132 of
http://www.w3.org/Math/XMLSchema/mathml2/presentation/scripts.xsd
[ERROR] The following location is relevant to the above error
line 138 of
http://www.w3.org/Math/XMLSchema/mathml2/presentation/scripts.xsd
Failed to parse a schema.
XMLSPY let's you download and try the full edition - I loaded up my .xsd and the product was able to chew through all the reference .xsd's and produce (many, many) java class files successfully ... so FYI ... In the meantime, I have been able to get JAXB to work using much smaller input .xds's. I got these (different part of project) by producing output XML from a tool, then using one of the online XML to XSD web sites to produce the .xsd which JAXB was able to process. I guess this is the only way 'round the MiOrMoOrMn problem.

Strange IIS/WCF Web Service Issue

Windows Server 2012 - IIS 8.x
I have a WCF web service (DLL) deployed in IIS that supports SOAP and REST over https. There is a certificate installed from Comodo for the SSL.
When I create a proxy for the service in C# apps everything works fine. Also, when I call most of the REST methods from a browser or from Postman they also work fine.
But there are a few REST methods that fail with no exception. In Chrome browser I get an error that says: "This site can't be reached." In Postman I get an error that says: "Could not get any response."
When I check the code in the WCF service I can see that the method gets called and actually executes with no exception, but nothing is returned. I've also checked the IIS logs and I don't seem to see any errors.
Here is an example of a method that works fine:
[OperationContract]
[WebGet(ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped, UriTemplate = "/GetActivityRules?agencyID={agencyID}")]
List<ActivityRule> GetActivityRules(int agencyID);
Yet, this method fails:
[OperationContract]
[WebGet(ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped, UriTemplate = "/GetActivity?agencyID={agencyID}&userID={userID}&date={date}&view={view}")]
List<Activity> GetActivity(int agencyID, int userID, string date, string view);
Has anyone experienced this before or have any ideas why this is happening or how best to troubleshoot?
UPDATE #1
I added code to the GetActivity function that writes to a log file each time its called. I can see the function executes correctly without error each time, but still there is no response. Makes me wonder if the problem is not related to WCF. I also added a trace listener to web config, but the file never gets created.
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true">
<listeners>
<add name="traceListener"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData= "C:\Samadhi\TraceLog.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
UPDATE #2
I spent a week of mind numbing searching, reading, and checking everything I possibly could with no result. I raised a support issue with Microsoft, which was escalated to one of their senior engineers. They have spent two days looking into the problem with still no solution. They tell me they have never seen this before!
I tried using your code and testing it locally, and it looked like everything was working fine. Even if method 2 contains multiple parameters, WCF can receive them. I think the problem is somewhere else. For example, if the data volume transfer is too large, please try to configure the following code in the binding.
<binding name="mybinding" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" sendTimeout="00:10:00" receiveTimeout="00:10:00">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" />
Or you can construct the collection return directly to eliminate problems with backend data queries.
to enable wcf tracing, you have to create a source configuration for System.ServiceModel. This should trace the service serialization:
<system.diagnostics>
<sources>
<source name="System.ServiceModel" switchValue="Verbose" propagateActivity="true">
<listeners>
<add name="svc" />
</listeners>
</source>
</sources>
<sharedListeners>
<add name="svc" type="System.Diagnostics.XmlWriterTraceListener" traceOutputOptions="DateTime" initializeData="c:\trace.svclog" />
</sharedListeners>
<trace autoflush="true" indentsize="4">
<listeners>
<add name="svc" />
<remove name="Default" />
</listeners>
</trace>
<system.diagnostics>
How frustrating software development can be. I swear I'm going to need hair replacement therapy soon. I finally found what was causing the issue, and as is most often the case, it boils down to my programming error. The frustrating part is when you have no error message, or when a framework throws a generic error that gives no clue as to what's wrong.
The issue came down to the fact that WCF was unable to return the JSON result - unable to parse the list of objects into JSON. This happened because an uninitialised date value was outside the allowed min and max values. The net result was no response from the server, not even an error code. When calling the same method using SOAP, the XML parsed fine - only the REST call was failing.
I initially had problems setting up WCF trace. For some reason it was causing the service to stop working. And because it was a production server, I had only limited time frames to work with when making config changes. Finally after seeing the JSON error message I knew what to do to fix the problem.

IISExpress 8 with custom configuration file - web service won't load

When I develop a WCF service or website solution, I always use IISExpress with a custom configuration file so I can share the setup with other developers in the team. Basically, I run a batch file with the following command in it:
"C:\Program Files (x86)\IIS Express\iisexpress.exe" /config:service-hosts.config
Where service-hosts.config is the path to my custom configuration file.
This method has been working perfectly fine, and still works fine in other solutions on my PC (each with their own service-hosts.config file). However, I've just started having a problem loading a WCF service using this method. I'm getting the following error when trying to browse to the service root dir, or any of the built in help endpoints:
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Detailed Error Information:
Module IIS Web Core
Notification Unknown
Handler Not yet determined
Error Code 0x80070003
Config Error Cannot read configuration file
Config File \?\D:\Projects\MyProject\WCFSite\web.config
Requested URL http:// localhost:80/
Physical Path
Logon Method Not yet determined
Logon User Not yet determined
Request Tracing Directory C:\Users\Spikeh\Documents\IISExpress\TraceLogFiles\
Config Source:
-1:
0:
More Information:
This error occurs when there is a problem reading the configuration file for the Web server or Web application. In some cases, the event logs may contain more information about what caused this error.
If you see the text "There is a duplicate 'system.web.extensions/scripting/scriptResourceHandler' section defined", this error is because you are running a .NET Framework 3.5-based application in .NET Framework 4. If you are running WebMatrix, to resolve this problem, go to the Settings node to set the .NET Framework version to ".NET 2". You can also remove the extra sections from the web.config file.
View more information ยป
I've been debugging for hours and can't get this error to change, let alone fix it.
I've tried overwriting my service-hosts.config file with a few different versions of applicationHosts.config, running IISExspress in 64bit, replacing the web.config file with a very basic version, setting permissions on the directory (to the point where every user on my PC has access), and changing the app pool, but still no change.
The weird thing is... when I change the WCF project to use "IISExpress" in the Web section of project properties, then subsequently debug the project, everything works fine... even with all of my web.config settings in place.
This points to how I'm running IISExpress, or my service-hosts.config file... though the service-hosts.config file (with slight modifications for the sites involved) is exactly the same as it is in my other projects.
One thing to note (might be a red herring), but I did downgrade the solution from VS2012 to VS2010, and changed the framework target to .Net 4.0... not sure if something might be configured funny due to that?
Does anyone have any ideas? I'm at the point of jumping off the roof...
UPDATE:
Here's the debug information from IISExpress (running with /trace:e):
Running IIS...
Starting IIS Express ...
Initializing the W3 Server Started CTC = 5514916
PreInitSitesThread: Premature Exit Occured ( hr = 80070003 )
W3 Server initializing WinSock. CTC = 5514916
W3 Server WinSock initialized. CTC = 5514916
W3 Server ThreadPool initialized (ipm has signalled). CTC = 5514916
Start listenerChannel http:0
Successfully registered URL "http://*:80/" for site "MyWebsite" application "/"
Registration completed for site "MyWebsite"
AppPool 'MyCustomAppPool' initialized
InitComplete event signalled
IIS Express is running.
Enter 'Q' to stop IIS Express
IncrementMessages called
Request ended: http://localhost:80/ with HTTP status 500.19
And here's the important part of my service-hosts.config:
<applicationPools>
<add name="Clr4IntegratedAppPool" managedRuntimeVersion="v4.0" managedPipelineMode="Integrated" CLRConfigFile="%IIS_BIN%\config\templates\PersonalWebServer\aspnet.config" autoStart="true" />
<add name="Clr4ClassicAppPool" managedRuntimeVersion="v4.0" managedPipelineMode="Classic" CLRConfigFile="%IIS_BIN%\config\templates\PersonalWebServer\aspnet.config" autoStart="true" />
<add name="Clr2IntegratedAppPool" managedRuntimeVersion="v2.0" managedPipelineMode="Integrated" CLRConfigFile="%IIS_BIN%\config\templates\PersonalWebServer\aspnet.config" autoStart="true" />
<add name="Clr2ClassicAppPool" managedRuntimeVersion="v2.0" managedPipelineMode="Classic" CLRConfigFile="%IIS_BIN%\config\templates\PersonalWebServer\aspnet.config" autoStart="true" />
<add name="UnmanagedClassicAppPool" managedRuntimeVersion="" managedPipelineMode="Classic" autoStart="true" />
<add name="IISExpressAppPool" managedRuntimeVersion="v4.0" managedPipelineMode="Integrated" CLRConfigFile="%IIS_BIN%\config\templates\PersonalWebServer\aspnet.config" autoStart="true" />
<add name="MycustomAppPool" managedRuntimeVersion="v4.0" managedPipelineMode="Integrated" CLRConfigFile="%IIS_USER_HOME%\config\aspnet.config" autoStart="true" />
<applicationPoolDefaults managedRuntimeLoader="v4.0" >
<processModel/>
</applicationPoolDefaults>
</applicationPools>
<listenerAdapters>
<add name="http" />
</listenerAdapters>
<sites>
<site name="MyWebsite" id="1">
<application path="/" applicationPool="MyCustomAppPool">
<virtualDirectory path="/" physicalPath="D:\Projects\MyProject\WCFSite\" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:80:" />
</bindings>
</site>
<siteDefaults>
<logFile logFormat="W3C" directory="%IIS_USER_HOME%\Logs" />
<traceFailedRequestsLogging directory="%IIS_USER_HOME%\TraceLogFiles" enabled="true" maxLogFileSizeKB="1024" />
</siteDefaults>
<applicationDefaults applicationPool="Clr4IntegratedAppPool" />
<virtualDirectoryDefaults allowSubDirConfig="true" />
</sites>
<webLimits />
Seems that the service-hosts.config file was pointing to something it shouldn't have been pointing to. I replaced my service-hosts.config with an copy from an older project (and therefore an older version of IISExpress / .Net Framework) and everything works fine.
Sounds like it was to do with my 4.5 -> 4.0 downgrade after all.

WCF Web Service Metadata Publishing Disabled Error

I modified my web.config to add a custom binding in order to increase the buffer and message size, and it seems like in creating the service element explicitly, it has somehow broken the reference to my behavior element.
When I try to run my web service from VS using the WCF Test Client, or I go to the service page, I get the error:
Metadata publishing for this service is currently disabled.
I've compared my web.config to a few different sources on this and everything seems to match. I've no idea what the issue is.
Here is the System.serviceModel element:
<system.serviceModel>
<services>
<service name="BIMIntegrationWS.BIMIntegrationService" behaviorConfiguration="metadataBehavior">
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<endpoint address="http://localhost:1895/BIMIntegrationService.svc"
binding="customBinding" bindingConfiguration="customBinding0"
contract="BIMIntegrationWS.IBIMIntegrationService"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="metadataBehavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<customBinding>
<binding name="customBinding0">
<binaryMessageEncoding />
<httpTransport maxReceivedMessageSize="262064"
maxBufferSize="262064"
maxBufferPoolSize="262064" />
</binding>
</customBinding>
</bindings>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true"/>
It almost seems like either the web service page is not finding the element. I don't get an error complaining that the target behaviorConfiguration doesn't exist, or anything like that, just that Metadata publishing is not enabled.
Any help would be greatly appreciated.
Thanks.
I think i've "fixed" the issue. More coming later.
EDIT:
In order to "fix" my issue, I basically added a new WCF service to my application, and had it implement my previous interface, I then copied all the code from my original service and when I tweaked the .config file (to look pretty much like the one posted in the question), everything worked fine.
Ofcourse, I know, like we all know, that there is no magic here, that there must be some discrepancy. This is when I noticed/remembered, that after I had created my original service, called "BIMIntegrationService.svc", I had decided that this was too long of a name, so I renamed/refactored my class to "BIMIntegrationWS". Doing this, however, does not change the name of the service file (and therefore the name of the file in the http:// address).
Long story short, I made 2 changes to my .config and everything worked:
1) I changed:
<service name="BIMIntegrationWS.BIMIntegrationService" behaviorConfiguration="metadataBehavior">
to
<service name="BIMIntegrationWS.BIMIntegrationWS" behaviorConfiguration="metadataBehavior">
After running the service like this, I got an error (a helpful one this time) complaining that if multipleSiteBindings was enabled, the endpoint address had to be relative. So:
2) I set that to false (because I don't remember why it was in there in the first place) and everything worked fine.
I guess I should have taken a hint when it seemed like my web service was not using my "service" element at all. :\
EDIT 2:
Actually, you can see in my second comment, in the original question, that the auto-generated tag was pointing to: , as opposed to "BIMIntegrationService".
That should have given it away.
I doubt many other people will have this same issue, but just in case.
I've had the same trouble; I've gotten everything configured correctly (even copied the code from a previous service I have running) and yet no change on allowing the service to expose metadata. yet, if I make a spelling error, parse error, etc. to the app.config I'm given exceptions telling me to correct the problem (which tells me the service is reading the config, just disregarding it.
I was able to bypass it by generating the config settings in the host application:
System.ServiceModel.Description.ServiceMetadataBehavior smb = new System.ServiceModel.Description.ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
ServiceBase host = new Servicebase(typeof(MyService), new Uri("http://localhost:1234/"));
host.Description.Behaviors.Add(smb);
host.Open();
...
host.Close();
Basically allow the code to override and push the config file changes i wanted applied. I know it's not ideal, but I was exposing the service through a windows service which made this do-able. if you do get your problem resolved, please pass along the solution though as I'd be curious to know why (at least in yours, if not both our cases) it's failing.

Where to define <Environment...> elements in JBoss

I try to define environment entries in JBoss 5.1 and added following to the server/default/deploy/jbossweb.sar/context.xml file:
<Environment type="java.lang.String" name="name" value="value" />
Following error occurs on startup:
2010-01-26 14:50:08,383 ERROR
[org.jboss.web.tomcat.service.deployers.JBossContextConfig]
(main) XML error parsing: context.xml
org.jboss.xb.binding.JBossXBException:
Failed to parse source: Resource
cannot appear in this position.
Expected content of Context is
unordered_sequence: attributes?
InstanceListener* Realm? Parameters*
Manager? Loader? Valve* SessionCookie?
Resources? Listener*
Where may I define environment entries in JBoss (but outside of application's EAR)?
This article confirms that (likely) it is not possible to configure environment entries in JBoss. Author suggests to use PropertiesService as alternative.
Property configuration in properties-service.xml works great!