Want something inexpensive that just tells me how many calls a number gets, id like a different # for different sources of users and want to track volume from each source
Any ideas?
Thanks
Aaron
I have created two WCF Services (Shipping & PDFGenerator). They both, along with my ClientApp, share an assembly named Kyle.Common.Contracts. Within this assembly, I have three classes:
namespace Kyle.Common.Contracts
{
[MessageContract]
public class PDFResponse
{
[MessageHeader]
public string fileName { get; set; }
[MessageBodyMember]
public System.IO.Stream fileStream { get; set; }
}
[MessageContract]
public class PDFRequest
{
[MessageHeader]
public Enums.PDFDocumentNameEnum docType { get; set; }
[MessageHeader]
public int? pk { get; set; }
[MessageHeader]
public string[] emailAddress { get; set; }
[MessageBodyMember]
public Kyle.Common.Contracts.TrackItResult[] trackItResults { get; set; }
}
[DataContract(Name = "TrackResult", Namespace = "http://kyle")]
public class TrackResult
{
[DataMember]
public int SeqNum { get; set; }
[DataMember]
public int ShipmentID { get; set; }
[DataMember]
public string StoreNum { get; set; }
}
}
My PDFGenerator ServiceContract looks like:
namespace Kyle.WCF.PDFDocs
{
[ServiceContract(Namespace="http://kyle")]
public interface IPDFDocsService
{
[OperationContract]
PDFResponse GeneratePDF(PDFRequest request);
[OperationContract]
void GeneratePDFAsync(Kyle.Common.Contracts.Enums.PDFDocumentNameEnum docType, int? pk, string[] emailAddress);
[OperationContract]
Kyle.Common.Contracts.TrackResult[] Test();
}
}
If I comment out the GeneratePDF stub, the proxy generated by VS2010 realizes that Test returns an array of Kyle.Common.Contracts.TrackResult. However, if I leave GeneratePDF there, the proxy refuses to use Kyle.Common.Contracts.TrackResult, and instead creates a new class, ClientApp.PDFDocServices.TrackResult, and uses that as the return type of Test.
Is there a way to force the proxy generator to use Kyle.Common.Contracts.TrackResult whenever I use a MessageContract? Perhaps there's a better method for using a Stream and File Name as return types?
I just don't want to have to create a Copy method to copy from ClientApp.PDFDocServices.TrackResult to Kyle.Common.Contracts.TrackResult, since they should be the exact same class.
Thanks in advance,
Kyle
Hi,
See the following Mock Test by using Spring/Spring-MVC
public class OrderTest {
// SimpleFormController
private OrderController controller;
private OrderService service;
private MockHttpServletRequest request;
@BeforeMethod
public void setUp() {
request = new MockHttpServletRequest();
request.setMethod("POST");
Integer orderNumber = 421;
Order order = new Order(orderNumber);
// Set up a Mock serviceservice = createMock(OrderService.class);
service.save(order);
replay(service);
controller = new OrderController();
controller.setService(service);
controller.setValidator(new OrderValidator());
request.addParameter("orderNumber", String.valueOf(orderNumber));
}
@Test
public void successSave() {
controller.handleRequest(request, new MockHttpServletResponse());
// Our OrderService has been called by our controller
verify(service);
}
@Test
public void failureSave() {
// Ops... our orderNumber is required
request.removeAllParameters();
ModelAndView mav = controller.handleRequest(request, new MockHttpServletResponse());
BindingResult bindException = (BindingResult) mav.getModel().get(BindingResult.MODEL_KEY_PREFIX + "command");
assertEquals("Our Validator has thrown one FieldError", bindException.getAllErrors(), 1);
}
}
As you can see, i do as proposed by Triple A pattern
Arrange (setUp method)
Act (controller.handleRequest)
Assert (verify and assertEquals)
But i would like to test both Mock and Implementation class (OrderService) by using this single Test class. So in order to retrieve my Implementation, i re-write my class as follows
@ContextConfiguration(locations="/app.xml")
public class OrderTest extends AbstractTestNGSpringContextTests {
}
So how should i write my single test to Arrange both Mock and Implementation OrderService without change my Test method (sucessSave and failureSave)
I am using TestNG, but you can show in JUnit if you want
regards,
i want get data from a webserver (.net) and display it into my website.
my code is :
$client = new soapclient('http://www.tsetmc.com/WebService/TsePublic.asmx?WSDL', true);
$client->useHTTPPersistentConnection();
$user = array('UserName' => 'etc');
$pass = array('Password' => 'etc');
$result = $client->call('Board', $user, $pass);
print_r( $result );
and i get this error :
Warning: Illegal offset type in isset
or empty in
/home/mmdicir/public_html/lib/nusoap-0.7.3/lib/nusoap.php
on line 7211 Array ( [faultcode] =
soap:Server [faultstring] = Server
was unable to process request. ---
String reference not set to an
instance of a String. Parameter name:
s [detail] = )
Background information:
.Net Website which calls a service (aka external service) facade on an app server in the DMZ. This external service then calls the internal service which is on our internal app server. From there that internal service calls a stored procedure (Linq to SQL Classes), and passes the serialized data back though to the external service, and from there back to the website.
We've done this so any communication goes through an external layer (our external app server) and allows interoperability; we access our data just like our clients consuming our services.
We've gotten to the point in our development where we have completed the system and it all works, the double hop acts as it should. However now we are working on securing the entire process.
We are looking at using TransportWithMessageCredentials.
We want to have WS2007HttpBinding for the external for interoperability, but then netTCPBinding for the bridge through the firewall for security and speed.
Questions:
If we choose WS2007HttpBinding as the external services binding, and netTCPBinding for the internal service is this possible?
I know WS-* supports this as does netTCP, however do they play nice when passing credential information like user/pass?
If we go to Kerberos, will this impact anything? We may want to do impersonation in the future.
If you can when you answer post any reference links about why you're answering the way you are, that would be very helpful to us. Thanks!
I'll let users register their [email protected] ,,, they enter their members area where they can :
1- send emails ( easy to do)
2- receive emails ..
for receiving emails , I'll use a catch all email account , read the email and figure to whom it's sent (username), and then I save it on the database with userid of the username who has registerd !
Do I miss something here ... is it really this simple (if I don't have an email server) ?
During the installation of Apache2 I got the following message into cmd window:
Installing the Apache2.2 service The
Apache2.2 service is successfully
installed. Testing httpd.conf....
Errors reported here must be corrected
before the service can be started.
httpd.exe: Could not reliably
determine the server's fully qualified
domain name , using 192.168.1.3 for
ServerName (OS 10048)Only one usage of
each socket address (protocol/network
address/port) is normally permitted.
: make_sock: could not bind to address
0.0.0.0:80 no listening sockets available, shutting down Unable to
open logs Note the errors or messages
above, and press the key to
exit. 24...
and after installing everything look fine, but it isn't. If I try to start service I got the following message:
Windows could not start the Apache2 on
Local Computer. For more information,
review the System Event Log. If this
is a non-Micorsoft service, contact
the service vendor, and refer to
service-specific error code 1.
Apach2 version is 2.2.9
Does anyone have the same problem, or could help me.
The standard HTTP Authentication for SOAP passed the password etc in cleartext,and I'm looking for an alternative, possibly a key based mechanism to authenticate web services in lieu of the password.
OAuth is gaining a lot of popularity; would it be appropriate, and how would I implement it? Or perhaps there are other methods I should use.
The project itself is relatively simple, with just a one or two methods to be exposed, but security is of the utmost importance.
The idea is to allow to peer processes to exchange messages (packets) over tcp as much asynchronously as possible.
The way I'd like it to work is each process to have an outbox and an inbox. The send operation is just a push on the outbox. The receive operation is just a pop on the inbox. Underlying protocol would take care of the communication details.
Is there a way to implement such mechanism using a single TCP connection?
How would that be implemented using BSD sockets and modern OO Socket APIs (like Java or C# socket API)?
I have a 3rd-party protocol module (SNMP) that is built on top of asyncore. The asyncore interface is used to process response messages. What is the proper technique to design a client that generate the request-side of the protocol, while the asyncore main loop is running. I can think of two options right now:
Use the loop,timeout parameters of asyncore.loop() to allow my client program time to send the appropriate request.
Create a client asyncore dispatcher that will be executed in the same asyncore processing loop as the receiver.
What is the best option? I'm working on the 2nd solution, cause the protocol API does not give me direct access to the asyncore parameters. Please correct me if I've misunderstood the proper technique for utilizing asyncore.
We are in the process of testing different options for sending faxes from within our C# code (receiving faxes is not necessary). One of those options is to use FAXCOMEXLib.
Without surprise, I've had pretty good success sending out black & white faxes with FAXCOMExLib. But we also have a requirement to support sending color faxes. So I execute the following code (just a snippet):
IFaxDocument oFaxDoc = new FaxDocumentClass();
oFaxDoc.Body = @"C:\Test\color_image.jpg";
oFaxDoc.ConnectedSubmit(m_oFaxServer);
The image is 24bit color, 1728x2304, 204x196 dpi.
For the most part, this process works (with a couple of small quirks) and the fax shows up in my "Windows Fax and Scan" outbox (I'm on Vista). The problem is the image has been dithered to a 1bit black & white image. I assume that what I see in "Windows Fax and Scan" is what is actually transmitted.
So is there a way to send a color fax using this technology? Are we missing a configuration option somewhere to make it work?
I'm technically savvy but don't have extensive experience with servers/daemons (I'm a Windows guy, so...command lines intimidate me).
I started a Mercurial server using the hg serve -d command, and all was well.
Now, I want to stop it, and can't find a process to kill. Does anybody know the process name or a relatively simply CLI command to get it done?
Hi,
I have just started learning Ruby on Rails.
I happened to look for prevention of DNS attacks in Rails and ended up reading about DNS, Session fixation and Cross Site request forgery in Rails?
How do you prevent all the above three attacks??
Could you suggest me a good tutorial on how to deal with attack in RoR?
Looking forward for your help
Thanks in advance
Regards,
Gautam
Retrieving data from the REST Server works well, but if I want to post an object it doesn't work:
public static void postJSONObject(int store_type, FavoriteItem favorite, String token, String objectName) {
String url = "";
switch(store_type) {
case STORE_PROJECT:
url = URL_STORE_PROJECT_PART1 + token + URL_STORE_PROJECT_PART2;
//data = favorite.getAsJSONObject();
break;
}
HttpClient httpClient = new DefaultHttpClient();
HttpPost postMethod = new HttpPost(url);
try {
HttpEntity entity = new StringEntity("{\"ID\":0,\"Name\":\"Mein Projekt10\"}");
postMethod.setEntity(entity);
HttpResponse response = httpClient.execute(postMethod);
Log.i("JSONStore", "Post request, to URL: " + url);
System.out.println("Status code: " + response.getStatusLine().getStatusCode());
} catch (ClientProtocolException e) {
I always get a 400 Error Code. Does anybody know whats wrong?
I have working C# code, but I can't convert:
System.Net.WebRequest wr = System.Net.HttpWebRequest.Create("http://localhost:51273/WSUser.svc/pak3omxtEuLrzHSUSbQP/project");
wr.Method = "POST";
string data = "{\"ID\":1,\"Name\":\"Mein Projekt\"}";
byte [] d = UTF8Encoding.UTF8.GetBytes(data);
wr.ContentLength = d.Length;
wr.ContentType = "application/json";
wr.GetRequestStream().Write(d, 0, d.Length);
System.Net.WebResponse wresp = wr.GetResponse();
System.IO.StreamReader sr = new System.IO.StreamReader(wresp.GetResponseStream());
string line = sr.ReadToEnd();
I need to geocode adresses (get lat/long from addresses) using in .Net, to store in the database.
What is the library/project to look into, to get that done?
After a search here, on google and codeplex.com, I have found there to be a few options, that seem like they will do what I ask for... But some of them could be crap and a waste of time - and some might just be stellar.
Which one is the one to go for? Have you used any of them?
I would like to post a form using ajax and jquery to a .asmx webservice and return the value from the webservice as JSON.
I'm using ASP.NET 4.0. I know that in order to return JSON from a webservice the following needs to be set (1) dataType: "json" (2) contentType: "application/json; charset=utf-8", (3) type: "POST" (4) set the Data to something. I have tested this and it works fine (i.e. my webservice returns the data as JSON) if all *four are set*.
But, lets say in my case I want to do a standard form post i.e. test1=value1&test2=value2
so the contentType is not JSON but I want back JSON {test1:value1}. This doesn't seem to work because the contentType is "application/x-www-form-urlencoded" not "application/json; charset=utf-8".
Can anyone tell me why I can't do this? It seems crazy to me that you have to explicitly
send JSON to get JSON back, yet if you don't use JSON (i.e. post urlencoded contenttype) then the webservice will return XML.
Any insights are greatly appreciated :)
hello freinds
i am new in ssrs i want some sugeestiion from You can i use ssrs in windows application in .net if yes then please tell me?
Thanks in advance
I'm trying to add a log monitor to an in-house test utility for a windows service I'm working on. The service is written in C++ (win32) and the utility is in .NET (C#)
The log monitor works for many other C++ apps I've written, but not for my service.
The only main difference I can see is that the other apps use the older ::WriteFile() to output to the log, whereas in the service I'm using std::ofstream like this:
std::ofstream logFile;
logFile.open("C:\\mylog.log");
logFile << "Hello World!" << std::endl;
logFile.flush();
From my utility I use FileSystemWatcher like this:
FileSystemWatcher fsw = new FileSystemWatcher(@"C:\", "mylog.log");
fsw.Changed += new FileSystemEventHandler(fsw_Handler);
fsw.EnableRaisingEvents = true;
But for the service, it never gets any change events as the log is updated. I've found that any example code using FileSystemWatcher I've come across online has the same exact issue as well...
But, I know the events should be available because other log monitor apps (like BareTail) work fine with the service log file.
I'd rather get the C# code for the utility to just work so it works with anything, but if I have to change the logging code for the service I will. Does anyone see what's going wrong here?
I have a silverlight application that needs to talk to a rails app to add a record. I have been able to get the silverlight app to successfully do the POST assuming everything goes good. Now, however, I need to be able to make it more robust and have the rails app return error/success messages to the silverlight app in a format it can read (xml maybe?). I can modify the rails app and silverlight app as needed.
What is the best way to accomplish this with rails?
Hi,
I have a public interface auto-generated bu svcutil:
[System.ServiceModel.ServiceContractAttribute(Namespace="...", ConfigurationName="...")]
public interface MyInterface
Then I have asmx web service inheriting it and working fine. I am trying ot convert it to WCF but when I instrument the service (in asmx.cs code behind) with ServiceContract:
[ServiceContract(Namespace = "...")]
public class MyService : MyInterface
Also I have cerated .svc file and added the system.serviceModel setting in the config file. The goal is to migrate the asmx service to WCF service.
I've got this error:
The service class of type MyService both defines a ServiceContract and inherits a ServiceContract from type MyInterface. Contract inheritance can only be used among interface types. If a class is marked with ServiceContractAttribute, it must be the only type in the hierarchy with ServiceContractAttribute.
The asmx service is still working fine. Only the .svc is giving me issues. My question is how to fix that. MyInterface is an interface so I do not see what the problem is and why I've got the error anyway.
Note I do not want to change MyInterface, because it is autogenerated from svcutil from my wsdl schema and I do not want this interface to be edited manually. The whole idea is to have the service types automatically genereted from WSDL and to save my team development efforts with manual editing.
Any help is appreciated.
Hello, All.
I've tried video recording in the background.
But had failed.
Under normal circumstances, the recording works properly.
However, if HOME key down- Home screen or Other Activity is running,
recording terminates.
In such a situation, I want to record continuously.
I want to record whole process!
What should I do?
thanks.
-Michael
We all know that we can always wrap our database call in transaction ( with or without a proper ORM), in a form like this:
$con = Propel::getConnection(EventPeer::DATABASE_NAME);
try {
$con->begin();
// do your update, save, delete or whatever here.
$con->commit();
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
This way would guarantee that if the transaction fails, the database is restored to the correct status.
But the problem is that let's say when I do a transaction, in addition to that transaction, I need to update another database ( an example would be when I update an entry in a column in databaseA, another entry in a column in databaseB must be updated). How to handle this case?
Let's say, this is my code, I have three databases that need to be updated ( dbA, dbB, dbc):
$con = Propel::getConnection("dbA");
try {
$con->begin();
// update to dbA
// update to dbB
//update to dbc
$con->commit();
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
If dbc fails, I can rollback the dbA but I can't rollback dbb.
I think this problem should be database independent. And since I am using ORM, this should be ORM independent as well.
Update: Some of the database transactions are wrapped in ORM, some are using naked PDO, oledb ( or whatever bare minimum language provided database calls). So my solution has to take care this.
Any idea?