Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by tom_sas · Jan 22, 2019 at 03:08 PM · 4.6.netsoap

using SOAP web service fails in windows build due to runtime code generation (2017.3, .net 4.6)

Hello!

I'm having a problem using a SOAP web service in a standalone windows build. We are using 2017.3 with experimental .net 4.6 scripting runtime enabled.

The web service client implementation was generated from the wsdl document using the wsdl.exe tool. Everything works fine when testing it in the editor, but in the standalone build it throws an exception when creating an instance of that client implementation class:

   at Mono.CSharp.CSharpCodeCompiler.CompileFromFileBatch (System.CodeDom.Compiler.CompilerParameters options, System.String[] fileNames) [0x00162] in <3649452ae23840d49bd323a708498f78>:0 
   at Mono.CSharp.CSharpCodeCompiler.CompileFromSourceBatch (System.CodeDom.Compiler.CompilerParameters options, System.String[] sources) [0x00088] in <3649452ae23840d49bd323a708498f78>:0 
   at Mono.CSharp.CSharpCodeCompiler.CompileAssemblyFromSourceBatch (System.CodeDom.Compiler.CompilerParameters options, System.String[] sources) [0x0000f] in <3649452ae23840d49bd323a708498f78>:0 
   at System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromSource (System.CodeDom.Compiler.CompilerParameters options, System.String[] sources) [0x00006] in <3649452ae23840d49bd323a708498f78>:0 
   at System.Xml.Serialization.Compiler.Compile (System.Reflection.Assembly parent, System.String ns, System.Xml.Serialization.XmlSerializerCompilerParameters xmlParameters, System.Security.Policy.Evidence evidence) [0x00144] in <03e950671d964403ab67ff751c460757>:0 
   at System.Xml.Serialization.TempAssembly.GenerateAssembly (System.Xml.Serialization.XmlMapping[] xmlMappings, System.Type[] types, System.String defaultNamespace, System.Security.Policy.Evidence evidence, System.Xml.Serialization.XmlSerializerCompilerParameters parameters, System.Reflection.Assembly assembly, System.Collections.Hashtable assemblies) [0x004c2] in <03e950671d964403ab67ff751c460757>:0 
   at System.Xml.Serialization.TempAssembly..ctor (System.Xml.Serialization.XmlMapping[] xmlMappings, System.Type[] types, System.String defaultNamespace, System.String location, System.Security.Policy.Evidence evidence) [0x0006a] in <03e950671d964403ab67ff751c460757>:0 
   at System.Xml.Serialization.XmlSerializer.GetSerializersFromCache (System.Xml.Serialization.XmlMapping[] mappings, System.Type type) [0x00111] in <03e950671d964403ab67ff751c460757>:0 
   at System.Xml.Serialization.XmlSerializer.FromMappings (System.Xml.Serialization.XmlMapping[] mappings, System.Type type) [0x000a2] in <03e950671d964403ab67ff751c460757>:0 
   at System.Web.Services.Protocols.SoapClientType..ctor (System.Type type) [0x000e1] in <3cfb32c731574db69b82bd4c837721a0>:0 
   at System.Web.Services.Protocols.SoapHttpClientProtocol..ctor () [0x0004f] in <3cfb32c731574db69b82bd4c837721a0>:0 
   at MantisConnect.MantisConnect..ctor () [0x00000] in <35039125407142ba85ccc2c953b98a76>:0 
 

From what I've seen, it generates C# code for xml serialization and attempts to compile it. This works in the editor, but in a build it fails to find a mono compiler (obviously).

I then found out it's possible to use the sgen.exe tool to pre-generate an assembly containing the xml serializers, which is then supposed to be loaded and used instead of generating the code at runtime.

It seems that assembly is in fact loaded, but is still not used.

I spent days using ILSpy to understand what's going on, and have tried various things, but I just can't seem to get this to work.

So my question is: Does anyone successfully use a SOAP web service in a standalone windows build, and if so, how? Also, is the wsdl.exe + sgen.exe the correct way to generate the things I need, and am I just missing a detail?

Thanks in advance for any help/ideas/pointers in the right direction!

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by tom_sas · Jan 28, 2019 at 04:52 PM

Turns out wsdl.exe + sgen.exe does indeed work, BUT the sgen.exe tool provided as part of a unity installation (...\Editor\Data\MonoBleedingEdge\lib\mono\4.5\sgen.exe) does not generate everything that's needed. That's why the generated assembly is still not used in the end.


I've resolved the issue by using a sgen.exe tool provided as part of the microsoft SDKs, which does the job correctly. ILSpy showed that the generated assembly does indeed contain things that were missing before.


For anyone trying to find the sgen.exe tool, it was located under "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools" on my machine. Various similar folders exist there which should have it.


Also, don't forget to add System.Web.Services.dll to your unity project. The one provided as part of unity works and can be found under "...\Editor\Data\MonoBleedingEdge\lib\mono\4.6-api"

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by khoowaikeong · Jan 08 at 08:44 AM

is it possible to use webservice on andriod?

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

100 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Has anyone used the new .net 4.6 with ARCore and ARKit in production? 0 Answers

.NET framework 4.6 support issue 1 Answer

HTML5 target : Codepage 1252 not supported 1 Answer

Unity Task not working with target Universal Windows Platform,Use System.Threading.Tasks on UWP 0 Answers

Unable to debug .NET 4.x 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges