简体   繁体   中英

Accessing soap over https in silverlight

I have a server that i am hosting on another computer with axis2 and apache. IM simply trying to connect to it over https.

CustomBinding binding = new CustomBinding(SecurityBindingElement.CreateUserNameOverTransportBindingElement());

binding.Elements.Add(new HttpsTransportBindingElement());
EndpointAddress endpoint = new EndpointAddress("https://othercomputer/axis2/services/DataModel");
DataClient client = new DataClient(binding, endpoint);
client.ClientCredentials.UserName.UserName = "a";
client.ClientCredentials.UserName.Password = "a12345";
return client;

I get a communication exception was unhandled by user code with this code, am i doing it right?

Edit with further requested info: Heres the exception:

An error occurred while trying to make a request to URI 'https://othercomputer/axis /services/DataModel'. This could be due to attempting to access a service in a cross- domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. This error may also be caused by using internal types in the web service proxy without using the InternalsVisibleToAttribute attribute. Please see the inner exception for more details.

The authentication is basic authentication, one of my coworkers thinks its a problem with the certificate and thought that it might be because the certificate is self-generated.

Its being treated as a cross-domain call. You need to add a clientaccesspolicy.xml file that is accessible through the same server that you are making the SOAP call to.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM