Server-Side XML Validation with CXF Webservice

You can override validation error messages, inserting a line number, by using a custom ValidationEventHandler: package example; import javax.xml.bind.ValidationEvent; import javax.xml.bind.helpers.DefaultValidationEventHandler; public class MyValidationEventHandler extends DefaultValidationEventHandler { @Override public boolean handleEvent(ValidationEvent event) { if (event.getSeverity() == ValidationEvent.WARNING) { return super.handleEvent(event); } else { throw new RuntimeException(event.getMessage() + ” [line:”+event.getLocator().getLineNumber()+”]”); } } } If you configure … Read more

The content type text/html; charset=UTF-8 of the response message does not match the content type of the binding (text/xml; charset=utf-8)

Since the returned content type is text/html, I suspect your call result in a server-side error outside of WCF (you are receiving an HTML error page). Try viewing the response with a web debugging proxy such as Fiddler. (Edit based on comments) : Based on your comments, I see that your WCF is hosted under … Read more

Upload image to the PHP server from iOS

You can upload image from iOS App to PHP server like this two way: Using New AFNetworking : #import “AFHTTPRequestOperation.h” #import “AFHTTPRequestOperationManager.h” NSString *stringUrl =@”http://www.myserverurl.com/file/uloaddetails.php?” NSString *string =@”http://myimageurkstrn.com/img/myimage.png” NSURL *filePath = [NSURL fileURLWithPath:string]; NSDictionary *parameters = [NSDictionary dictionaryWithObjectsAndKeys:userid,@”id”,String_FullName,@”fname”,String_Email,@”emailid”,String_City,@”city”,String_Country,@”country”,String_City,@”state”,String_TextView,@”bio”, nil]; AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; [manager POST:stringUrl parameters:parameters constructingBodyWithBlock:^(id<AFMultipartFormData> formData) { [formData appendPartWithFileURL:filePath name:@”userfile” error:nil];//here userfile … Read more

Get/post to RESTful web service

You’ll need to add a reference to the MSXML library: Dim sUrl As String Dim response As String Dim xmlhttp Set sUrl = “http://my.domain.com/service/operation/param” Set xmlhttp = Server.CreateObject(“MSXML2.ServerXMLHTTP”) xmlhttp.open “POST”, sURL, False xmlhttp.setRequestHeader “Content-Type”, “application/x-www-form-urlencoded” xmlhttp.send() Dim response As String = xmlhttp.responseText Set xmlhttp = Nothing

Signing SOAP messages using X.509 certificate from WCF service to Java webservice

OK. After few tries and errors here is the solution using SignedXml and IClientMessageInspector/BeforeSendRequest pattern. Thanks a lot to Yaron Naveh for his relevant suggestions. // Sign an XML request and return it public static string SignRequest(string request, string SubjectName, string Signature, string keyInfoRefId) { if (string.IsNullOrEmpty(request)) throw new ArgumentNullException(“request”); if (string.IsNullOrEmpty(SubjectName)) throw new ArgumentNullException(“SubjectName”); … Read more